<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>docker run | Docker Docs
</title><meta name=description content=" "><meta name=keywords content="docker,docker open source,docker platform,distributed applications,microservices,containers,docker containers,docker software,docker virtualization"><link rel=canonical href="../../../../../engine/reference/commandline/run/index.html"><link rel=icon type=image/x-icon href="../../../../../assets/favicons/docs@2x.ico" sizes=129x128><link rel=apple-touch-icon type=image/x-icon href="../../../../../assets/favicons/docs@2x.ico" sizes=129x128><meta name=msapplication-TileImage content="https://docs.docker.com/assets/favicons/docs@2x.ico"><meta name=theme-color content="#2496ed"><meta name=twitter:title itemprop="title name" content="docker run"><meta name=twitter:description property="og:description" itemprop=description content=" "><meta name=twitter:card content="summary_large_image"><meta name=twitter:domain content="https://docs.docker.com"><meta name=twitter:site content="@docker_docs"><meta name=twitter:url content="https://twitter.com/docker_docs"><meta name=twitter:image:src content="https://docs.docker.com/assets/images/thumbnail.webp"><meta name=twitter:image:alt content="Docker Documentation"><meta property="og:title" content="docker run"><meta property="og:description" content=" "><meta property="og:type" content="website"><meta property="og:updated_time" itemprop=dateUpdated content="2024-02-22 09:20:44 +0100 +0100"><meta property="og:image" itemprop="image primaryImageOfPage" content="https://docs.docker.com/assets/images/thumbnail.webp"><meta property="og:locale" content="en_US"><meta property="og:url" content="https://docs.docker.com/reference/cli/docker/container/run/"><meta property="og:site_name" content="Docker Documentation"><meta property="article:published_time" itemprop=datePublished content="2024-02-22 09:20:44 +0100 +0100"><script type=application/ld+json>{"@context":"https://schema.org","@type":"WebPage","headline":"\"docker run\"","description":"\" \"","url":"https:\/\/docs.docker.com\/reference\/cli\/docker\/container\/run\/"}</script><script src=https://cdn.cookielaw.org/scripttemplates/otSDKStub.js type=text/javascript data-domain-script=8e0ebfd9-035d-4ec2-9b2f-a2de9c09f906></script><script type=text/javascript>function OptanonWrapper(){}</script><script>(function(e,t,n,s,o){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],i=t.createElement(n),r=s!="dataLayer"?"&l="+s:"";i.async=!0,i.src="https://www.googletagmanager.com/gtm.js?id="+o+r,a.parentNode.insertBefore(i,a)})(window,document,"script","dataLayer","GTM-WL2QLG5")</script><script>(function(e,t,n,s,o,i){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:3169877,hjsv:6},o=t.getElementsByTagName("head")[0],i=t.createElement("script"),i.async=1,i.src=n+e._hjSettings.hjid+s+e._hjSettings.hjsv,o.appendChild(i)})(window,document,"https://static.hotjar.com/c/hotjar-",".js?sv=")</script><link href="../../../../../assets/fonts/RobotoFlex.woff2" rel=preload as=font type=font/woff2 crossorigin><style>body>img{display:none}</style><link href="../../../../../css/styles.min.8767cc26123e21700c497beebf1cbd8dfdfec3499469fd8793a873c11b567264.css" rel=stylesheet><script>(()=>{function t(){let e=localStorage.getItem("theme-preference");return e||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}var e=t();document.firstElementChild.className=e==="dark"?"dark":"light",localStorage.setItem("theme-preference",e)})()</script><script defer src="../../../../../scripts.js"></script><link rel=preconnect href=https://3XRLW0LZH9-dsn.algolia.net crossorigin></head><body class="bg-background-light text-base dark:bg-background-dark dark:text-white"><header class="sticky top-0 z-20 h-16 px-4 text-white bg-gradient-to-r from-accent-light to-blue-light-500 dark:from-accent-dark dark:to-blue-dark-100"><div class="mx-auto flex h-full max-w-[1400px] items-center justify-between"><div class="flex h-full items-center gap-8 md:gap-2"><button x-data @click="() => {
      $store.showSidebar = ! $store.showSidebar;
      const sidebar = document.querySelector('#sidebar');
      if ($store.showSidebar) {
        sidebar.classList.replace('md:hidden', 'md:block');
      } else {
        sidebar.classList.replace('md:block', 'md:hidden');
      }
      }" class="icon-svg hidden px-4 md:block" aria-label=Menu><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M150-240q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T150-3e2h660q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T810-240H150zm0-210q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T150-510h660q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T810-450H150zm0-210q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T150-720h660q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T810-660H150z"/></svg></button><div><a title="Docker Docs home page" href="../../../../../index.html"><div><svg width="92" height="33" viewBox="0 0 92 33" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M31.4783 13.9171C30.6936 13.3542 28.6325 13.1137 27.1335 13.5441 27.0527 11.9527 26.2826 10.6119 24.8747 9.44209L24.3529 9.06908 24.0051 9.62859C23.3219 10.7333 23.0351 12.2054 23.1366 13.5441 23.2173 14.3684 23.4865 15.2954 24.0051 15.9686 22.0548 17.1748 20.2566 16.9011 12.2938 16.9011H.00279151C-.0334407 18.818.256417 22.505 2.4552 25.5056 2.69847 25.8367 2.96452 26.1578 3.25334 26.4668c1.7878 1.9092 4.48969 3.3085 8.53006 3.313C17.9471 29.7853 23.2277 26.234 26.4399 17.6471 27.4969 17.6659 30.2867 17.8491 31.6522 15.0361 31.6853 14.9886 32 14.2901 32 14.2901L31.4783 13.9171zM8.02461 11.9395H4.56805v3.6848H8.02461V11.9395zm4.46589.0H9.03394v3.6848H12.4905V11.9395zm4.4659.0H13.4998v3.6848h3.4566V11.9395zm4.4659.0H17.9657v3.6848h3.4566V11.9395zm-17.86461.0H.102171v3.6848H3.55873L3.55769 11.9395zM8.02357 7.28461H4.56702V10.9694H8.02357V7.28461zm4.46593.0H9.0329V10.9694h3.4566V7.28461zm4.4658.0H13.4988V10.9694h3.4565V7.28461zm0-4.65485H13.4988V6.31458h3.4565V2.62976z" fill="#fff"/><path d="M78.9658 8.41589C78.4538 8.41589 78.0459 8.81327 78.0459 9.30828 78.0459 9.81422 78.4538 10.2116 78.9658 10.2116 79.4827 10.2116 79.8801 9.81422 79.8801 9.30828 79.8797 8.81327 79.4823 8.41589 78.9658 8.41589zM78.9711 10.0216C78.5685 10.0216 78.2744 9.70606 78.2744 9.30868 78.2744 8.91697 78.5684 8.59575 78.9658 8.59575 79.3628 8.59575 79.6512 8.91697 79.6512 9.31435 79.6512 9.70606 79.3628 10.0216 78.9711 10.0216z" fill="#fff"/><path d="M79.1725 9.33586V9.32492C79.281 9.29211 79.3572 9.21636 79.3572 9.11793 79.3572 9.03083 79.3191 8.95995 79.2701 8.92227 79.2049 8.8842 79.1287 8.85706 78.9598 8.85706 78.8132 8.85706 78.6985 8.86799 78.6171 8.8846V9.77699H78.8241V9.41768H78.9217C79.0364 9.41768 79.0907 9.46143 79.1069 9.55906 79.134 9.66275 79.1502 9.74418 79.1777 9.77699H79.4009C79.3791 9.74418 79.3625 9.68989 79.3357 9.55379 79.3082 9.43348 79.2592 9.36826 79.1725 9.33586zM78.9274 9.27064H78.8298V9.01504C78.8517 9.00937 78.8893 9.0037 78.944 9.0037 79.0749 9.0037 79.1344 9.05838 79.1344 9.14021 79.134 9.23256 79.0416 9.27064 78.9274 9.27064z" fill="#fff"/><path d="M41.5015 10.32C42.47 10.32 43.285 9.9708 43.9785 9.27042 44.6631 8.57936 45.003 7.73518 45.003 6.73747V.752051C45.003.560855 44.9402.400849 44.8122.27568 44.6842.150511 44.5307.0869141 44.3463.0869141 44.158.0869141 44.0041.150511 43.8809.27568 43.7574.400849 43.697.560855 43.697.752051V3.94284C43.0639 3.41949 42.3327 3.15537 41.5015 3.15537 40.5354 3.15537 39.7086 3.50415 39.0244 4.20493 38.3399 4.90288 38 5.74746 38 6.73788 38 7.72829 38.3423 8.57045 39.0244 9.27082 39.7086 9.96877 40.533 10.32 41.5015 10.32zM39.4806 5.86736C39.5948 5.59394 39.7507 5.35778 39.946 5.15524 40.1416 4.9523 40.3746 4.79189 40.6399 4.67198 40.9076 4.55168 41.194 4.49294 41.5035 4.49294S42.0925 4.55168 42.3603 4.67198C42.628 4.79229 42.8585 4.9527 43.0566 5.15767 43.2547 5.36264 43.4106 5.60082 43.5244 5.86979 43.6387 6.1412 43.6966 6.4288 43.6966 6.73545 43.6966 7.04209 43.6383 7.33213 43.5244 7.6011V7.60596C43.4102 7.87736 43.2543 8.11554 43.0566 8.31808 42.8589 8.52346 42.626 8.68346 42.3603 8.80377 42.0925 8.92408 41.8085 8.98281 41.5035 8.98281S40.9076 8.92408 40.6399 8.80377C40.3721 8.68346 40.1416 8.52305 39.946 8.32011 39.7503 8.11716 39.5944 7.87898 39.4806 7.60798 39.3663 7.33456 39.3084 7.04452 39.3084 6.73788 39.308 6.43123 39.3663 6.1412 39.4806 5.86736z" fill="#fff"/><path d="M72.9696 8.97333C72.9696 8.78699 72.9092 8.62212 72.7853 8.49695 72.6621 8.37179 72.5062 8.30819 72.3198 8.30819 72.157 8.31305 72.0124 8.36692 71.8892 8.47548 71.6936 8.64521 71.4817 8.77484 71.2512 8.8599 71.0207 8.94497 70.7692 8.9871 70.4946 8.9871 70.2523 8.9871 70.0194 8.94943 69.7982 8.87165 69.5767 8.79388 69.3701 8.68774 69.1858 8.5484 68.9994 8.40905 68.839 8.24419 68.7017 8.04853 68.5644 7.85531 68.4595 7.64062 68.3898 7.40487H73.3418C73.5253 7.40487 73.6793 7.34127 73.8073 7.2161S73.9981 6.93093 73.9981 6.73973c0-.49541-.0862999999999943-.95517-.256-1.37726C73.5719 4.93795 73.3131 4.55353 72.9736 4.20921L72.9692 4.20678C72.2777 3.50883 71.4509 3.15723 70.4921 3.15723 69.5325 3.15723 68.6993 3.5064 68.0147 4.20678 67.3301 4.90473 66.9902 5.74932 66.9902 6.73973S67.3325 8.5723 68.0147 9.27268C68.6993 9.97062 69.5236 10.3222 70.4921 10.3222 71.372 10.3222 72.1331 10.0322 72.7804 9.45212 72.906 9.31966 72.9696 9.15966 72.9696 8.97333zM68.6924 5.43093C68.8301 5.2377 68.9925 5.07 69.1793 4.93106 69.368 4.79212 69.5726 4.68558 69.7986 4.60781 70.0243 4.53003 70.2547 4.49236 70.4925 4.49236 70.7299 4.49236 70.9604 4.53003 71.1836 4.60781 71.4072 4.68558 71.6126 4.79171 71.7961 4.93106 71.9824 5.07 72.1452 5.23527 72.2826 5.43093 72.4223 5.62415 72.5272 5.83884 72.5997 6.07459H68.3853C68.4526 5.84127 68.555 5.62658 68.6924 5.43093z" fill="#fff"/><path d="M75.3696 10.3222C75.5531 10.3222 75.7026 10.2562 75.8278 10.1265 75.9562 9.99692 76.0186 9.83894 76.0186 9.65747V6.74011c0-.3111.0582999999999885-.60357.1721-.8774C76.305 5.58928 76.4609 5.35312 76.6586 5.15058 76.8571 4.94764 77.0896 4.78723 77.3549 4.67178 77.6227 4.5539 77.9071 4.49476 78.2121 4.49476 78.5167 4.49476 78.8055 4.54904 79.0688 4.65517 79.1733 4.70216 79.2645 4.72606 79.3435 4.72606 79.4346 4.72606 79.5205 4.70945 79.5995 4.67421 79.6785 4.63897 79.7485 4.59157 79.8069 4.53041 79.8652 4.46924 79.9114 4.39835 79.9466 4.31572 79.9814 4.23551 80.0001 4.14842 80.0001 4.05404 80.0001 3.87013 79.9417 3.72147 79.8255 3.60602H79.8279C79.7117 3.49058 79.5646 3.40065 79.3876 3.33462 79.2106 3.26859 79.0174 3.22363 78.8055 3.19771 78.5957 3.17178 78.398 3.16003 78.2145 3.16003 77.7977 3.16003 77.4064 3.22849 77.0386 3.365 76.6708 3.50192 76.3305 3.69757 76.0186 3.95236V3.82517C76.0186 3.64127 75.9558 3.48571 75.8278 3.35568 75.7002 3.22606 75.5487 3.16003 75.3696 3.16003 75.1898 3.16003 75.0318 3.22606 74.9042 3.35568 74.7758 3.48531 74.713 3.64329 74.713 3.82517v5.8323C74.713 9.84137 74.7758 9.99692 74.9042 10.1265 75.0318 10.2562 75.1857 10.3222 75.3696 10.3222z" fill="#fff"/><path d="M52.4904 5.3649C52.3203 4.94281 52.0667 4.55596 51.7244 4.20678 51.0329 3.50883 50.2066 3.15723 49.2473 3.15723 48.2881 3.15723 47.4545 3.5064 46.7703 4.20678 46.0857 4.90473 45.7458 5.74932 45.7458 6.73973S46.0881 8.5723 46.7703 9.27268C47.4549 9.97062 48.2788 10.3222 49.2473 10.3222 50.2159 10.3222 51.0309 9.97305 51.7244 9.27268 52.409 8.58161 52.7488 7.73743 52.7488 6.73973 52.744 6.24472 52.6581 5.78699 52.4904 5.3649zM51.2703 7.60052V7.60538C51.1561 7.87678 51.0001 8.11497 50.8024 8.31751 50.6043 8.52288 50.3718 8.68288 50.1061 8.80319 49.8408 8.9235 49.5544 8.98224 49.2494 8.98224 48.9443 8.98224 48.6535 8.9235 48.3857 8.80319 48.118 8.68288 47.8875 8.52247 47.6918 8.31953 47.4962 8.11659 47.3402 7.8784 47.2264 7.6074 47.1122 7.33398 47.0543 7.04394 47.0543 6.7373 47.0543 6.43066 47.1126 6.14062 47.2264 5.86719 47.3406 5.59376 47.4966 5.35761 47.6918 5.15507 47.8875 4.95212 48.1204 4.79171 48.3857 4.67181 48.6535 4.5515 48.9399 4.49276 49.2494 4.49276 49.5588 4.49276 49.8383 4.5515 50.1061 4.67181S50.6043 4.95253 50.8024 5.1575C51.0005 5.36247 51.1565 5.60065 51.2703 5.86962 51.3845 6.14102 51.4425 6.42863 51.4425 6.73527 51.4429 7.04192 51.3845 7.33195 51.2703 7.60052z" fill="#fff"/><path d="M63.628 6.08918 66.2472 4.34856C66.4141 4.23352 66.4955 4.05731 66.4963 3.82034 66.4959 3.73163 66.4777 3.64737 66.4428 3.56798 66.408 3.48777 66.3614 3.41486 66.3031 3.35328 66.2448 3.29212 66.1751 3.24229 66.0957 3.20948 66.0167 3.17667 65.9304 3.15763 65.8397 3.15763 65.7092 3.15763 65.593 3.19085 65.4905 3.2589L61.7516 5.74689V.75674C61.7516.567974 61.6889.409993 61.5609.280369 61.4329.150744 61.2814.0847168 61.1023.0847168 60.9233.0847168 60.7649.150744 60.6365.280369 60.5085.409993 60.4457.567974 60.4457.75674V9.64778C60.4457 9.83168 60.5085 9.98966 60.6365 10.1217 60.7645 10.2538 60.9184 10.3198 61.1023 10.3198S61.4353 10.2538 61.5609 10.1217C61.6889 9.98966 61.7516 9.83168 61.7516 9.64778V7.33884L62.5152 6.82723l2.8894 3.31797C65.5209 10.2607 65.6675 10.3174 65.8421 10.3174 65.9329 10.3174 66.0191 10.3008 66.0981 10.2655 66.1771 10.2323 66.2472 10.1829 66.3055 10.1217 66.3639 10.0606 66.4104 9.98966 66.4453 9.90703 66.4801 9.82682 66.4987 9.73973 66.4987 9.65223 66.4987 9.47764 66.4384 9.3221 66.3173 9.18518l-2.6893-3.096z" fill="#fff"/><path d="M56.9841 10.3247C57.8595 10.3247 58.621 10.0346 59.2659 9.45457 59.4032 9.31319 59.4733 9.15035 59.4733 8.96159 59.4733 8.77282 59.4126 8.60998 59.2894 8.48522 59.1659 8.36005 59.0099 8.29645 58.824 8.29645 58.6656 8.30131 58.5283 8.3483 58.412 8.43782 58.2026 8.62173 57.9838 8.75864 57.7485 8.8506 57.5156 8.94255 57.262 8.98751 56.9849 8.98751 56.6799 8.98751 56.3959 8.92837 56.1282 8.81049 55.8604 8.69262 55.6275 8.53221 55.4274 8.33169 55.2273 8.13118 55.0689 7.89056 54.9547 7.61957 54.8404 7.34614 54.7825 7.05368 54.7825 6.74217 54.7825 6.43067 54.8409 6.1386 54.9547 5.86477 55.0689 5.59135 55.2269 5.35519 55.4274 5.15265V5.15022C55.6275 4.94727 55.8604 4.78686 56.1282 4.67142 56.3959 4.55354 56.6799 4.4944 56.9849 4.4944 57.2596 4.4944 57.5136 4.54139 57.7485 4.63577 57.9814 4.73015 58.205 4.86909 58.4165 5.05097 58.542 5.15224 58.6842 5.20409 58.8426 5.20409 59.0314 5.20409 59.1849 5.1405 59.3084 5.0133 59.432 4.88611 59.4924 4.7257 59.4924 4.5345 59.4924 4.34371 59.4178 4.16669 59.2663 4.02977 58.6239 3.4497 57.8623 3.15967 56.9845 3.15967c-.966099999999997.0-1.7929.34917-2.477 1.04955C53.8229 4.90717 53.483 5.75135 53.483 6.74217 53.483 7.73258 53.8253 8.57474 54.5075 9.27512 55.1912 9.97306 56.0156 10.3247 56.9841 10.3247z" fill="#fff"/><path d="M44.774 32.4167C43.578 32.4167 42.497 32.1407 41.531 31.5887 40.5803 31.0214 39.8213 30.2547 39.254 29.2887 38.702 28.3227 38.426 27.234 38.426 26.0227s.253-2.2923.759-3.243C39.7063 21.8137 40.4117 21.0547 41.301 20.5027 42.1903 19.9354 43.1947 19.6517 44.314 19.6517 45.2187 19.6517 46.0543 19.8434 46.821 20.2267 47.5877 20.5947 48.2317 21.1007 48.753 21.7447v-6.21C48.753 15.182 48.8603 14.8984 49.075 14.6837 49.305 14.469 49.5887 14.3617 49.926 14.3617 50.2787 14.3617 50.5623 14.469 50.777 14.6837S51.099 15.182 51.099 15.5347v10.488C51.099 27.234 50.8153 28.3227 50.248 29.2887 49.696 30.2547 48.9447 31.0214 47.994 31.5887 47.0433 32.1407 45.97 32.4167 44.774 32.4167zm0-2.07C45.556 30.3467 46.2537 30.1627 46.867 29.7947 47.4803 29.4114 47.9633 28.89 48.316 28.2307 48.6687 27.5714 48.845 26.8354 48.845 26.0227 48.845 25.1947 48.6687 24.4587 48.316 23.8147 47.9633 23.1707 47.4803 22.6647 46.867 22.2967 46.2537 21.9134 45.556 21.7217 44.774 21.7217 44.0073 21.7217 43.3097 21.9134 42.681 22.2967 42.0677 22.6647 41.577 23.1707 41.209 23.8147 40.8563 24.4587 40.68 25.1947 40.68 26.0227 40.68 26.8354 40.8563 27.5714 41.209 28.2307 41.577 28.89 42.0677 29.4114 42.681 29.7947 43.3097 30.1627 44.0073 30.3467 44.774 30.3467zm15.1719 2.07c-1.242.0-2.3384-.268299999999996-3.289-.805-.950699999999998-.552-1.702-1.3033-2.254-2.254C53.8662 28.3917 53.5979 27.2877 53.5979 26.0457c0-1.2573.268299999999996-2.3613.805-3.312.552-.965999999999998 1.3033-1.7173 2.254-2.254C57.6075 19.9277 58.7039 19.6517 59.9459 19.6517c1.2266.0 2.3153.276 3.266.827999999999999C64.1625 21.0164 64.9062 21.7677 65.4429 22.7337 65.9949 23.6844 66.2709 24.7884 66.2709 26.0457c0 1.242-.2684 2.346-.804999999999993 3.312C64.9292 30.3084 64.1855 31.0597 63.2349 31.6117 62.2842 32.1484 61.1879 32.4167 59.9459 32.4167zm0-2.07c.7973.0 1.5026-.183999999999998 2.116-.552C62.6752 29.4267 63.1505 28.9207 63.4879 28.2767 63.8405 27.6327 64.0169 26.889 64.0169 26.0457S63.8405 24.4587 63.4879 23.8147C63.1505 23.1554 62.6752 22.6417 62.0619 22.2737 61.4485 21.9057 60.7432 21.7217 59.9459 21.7217 59.1485 21.7217 58.4432 21.9057 57.8299 22.2737 57.2165 22.6417 56.7335 23.1554 56.3809 23.8147 56.0282 24.4587 55.8519 25.2024 55.8519 26.0457S56.0282 27.6327 56.3809 28.2767C56.7335 28.9207 57.2165 29.4267 57.8299 29.7947 58.4432 30.1627 59.1485 30.3467 59.9459 30.3467zm14.5205 2.07C73.2397 32.4167 72.1434 32.1407 71.1774 31.5887 70.2267 31.0214 69.4754 30.2624 68.9234 29.3117 68.3867 28.3457 68.1184 27.257 68.1184 26.0457 68.1184 24.8037 68.3867 23.6997 68.9234 22.7337 69.46 21.7677 70.196 21.0164 71.1314 20.4797 72.0667 19.9277 73.14 19.6517 74.3514 19.6517 75.256 19.6517 76.084 19.828 76.8354 20.1807 77.5867 20.518 78.2614 21.0317 78.8594 21.7217 79.0741 21.967 79.1507 22.22 79.0894 22.4807S78.8594 22.9714 78.5834 23.1707C78.3687 23.324 78.1311 23.3777 77.8704 23.3317 77.6097 23.2704 77.372 23.1324 77.1574 22.9177 76.406 22.1204 75.4707 21.7217 74.3514 21.7217 73.5694 21.7217 72.8794 21.9057 72.2814 22.2737 71.6834 22.6264 71.2157 23.1247 70.8784 23.7687 70.541 24.4127 70.3724 25.1717 70.3724 26.0457 70.3724 26.8737 70.541 27.6097 70.8784 28.2537 71.231 28.8977 71.714 29.4114 72.3274 29.7947 72.9407 30.1627 73.6537 30.3467 74.4664 30.3467 75.0031 30.3467 75.4707 30.2854 75.8694 30.1627 76.2834 30.0247 76.6591 29.8177 76.9964 29.5417 77.2417 29.3424 77.4947 29.235 77.7554 29.2197 78.0161 29.189 78.2461 29.258 78.4454 29.4267 78.706 29.6414 78.8517 29.8867 78.8824 30.1627 78.913 30.4234 78.821 30.661 78.6064 30.8757 77.5024 31.903 76.1224 32.4167 74.4664 32.4167zm11.6865.0C85.0795 32.4167 84.0829 32.2557 83.1629 31.9337 82.2582 31.5964 81.5529 31.1747 81.0469 30.6687 80.8169 30.4234 80.7172 30.1474 80.7479 29.8407 80.7939 29.5187 80.9472 29.258 81.2079 29.0587 81.5145 28.8134 81.8135 28.7137 82.1049 28.7597 82.4115 28.7904 82.6722 28.9207 82.8869 29.1507 83.1475 29.442 83.5615 29.718 84.1289 29.9787 84.7115 30.224 85.3555 30.3467 86.0609 30.3467 86.9502 30.3467 87.6249 30.201 88.0849 29.9097 88.5602 29.6184 88.8055 29.2427 88.8209 28.7827 88.8362 28.3227 88.6139 27.924 88.1539 27.5867 87.7092 27.2494 86.8889 26.9734 85.6929 26.7587 84.1442 26.452 83.0172 25.992 82.3119 25.3787 81.6219 24.7654 81.2769 24.014 81.2769 23.1247 81.2769 22.3427 81.5069 21.6987 81.9669 21.1927 82.4269 20.6714 83.0172 20.288 83.7379 20.0427 84.4585 19.782 85.2099 19.6517 85.9919 19.6517 87.0039 19.6517 87.9009 19.8127 88.6829 20.1347 89.4649 20.4567 90.0859 20.9014 90.5459 21.4687 90.7605 21.714 90.8602 21.9747 90.8449 22.2507 90.8295 22.5114 90.6992 22.7337 90.4539 22.9177 90.2085 23.0864 89.9172 23.14 89.5799 23.0787 89.2425 23.0174 88.9589 22.8794 88.7289 22.6647 88.3455 22.2967 87.9315 22.0437 87.4869 21.9057 87.0422 21.7677 86.5285 21.6987 85.9459 21.6987 85.2712 21.6987 84.6962 21.8137 84.2209 22.0437 83.7609 22.2737 83.5309 22.611 83.5309 23.0557 83.5309 23.3317 83.5999 23.5847 83.7379 23.8147 83.8912 24.0294 84.1825 24.2287 84.6119 24.4127 85.0412 24.5814 85.6699 24.75 86.4979 24.9187 87.6479 25.1487 88.5525 25.44 89.2119 25.7927 89.8865 26.1454 90.3695 26.5594 90.6609 27.0347 90.9522 27.4947 91.0979 28.0314 91.0979 28.6447 91.0979 29.35 90.9062 29.9864 90.5229 30.5537 90.1549 31.121 89.6029 31.5734 88.8669 31.9107 88.1462 32.248 87.2415 32.4167 86.1529 32.4167z" fill="#fff"/></svg></div></a></div><div><nav><ul class="box-content flex mt-1 gap-4 md:hidden"><li><a class="block py-1 px-2" href="../../../../../get-started/overview/index.html">Guides</a></li><li><a class="block py-1 px-2" href="../../../../../manuals/index.html">Manuals</a></li><li class=border-b-4><a class="block py-1 px-2" href="../../../../../app/working-with-app/index.html">Reference</a></li><li><a class="block py-1 px-2" href="../../../../../samples/index.html">Samples</a></li><li><a class="block py-1 px-2" href="../../../../../faq/index.html">FAQ</a></li></ul></nav></div></div><div class="flex items-center gap-6"><div id=docsearch></div><button aria-label="Theme switch" id=theme-switch class=svg-icon x-data="{ theme: localStorage.getItem('theme-preference') }" x-init="$watch('theme', value => {
        localStorage.setItem('theme-preference', value);
        document.firstElementChild.className = value;
      })" @click="theme = (theme === 'dark' ? 'light' : 'dark')">
<span class="icon-svg dark:hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-280q-83 0-141.5-58.5T280-480t58.5-141.5T480-680t141.5 58.5T680-480t-58.5 141.5T480-280zM70-450q-12.75.0-21.375-8.675Q40-467.351 40-480.175 40-493 48.625-501.5T70-510h1e2q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T170-450H70zm720 0q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T790-510h1e2q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T890-450H790zM479.825-760Q467-760 458.5-768.625T450-790v-1e2q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T510-890v1e2q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625zm0 720Q467-40 458.5-48.625T450-70v-1e2q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T510-170v1e2q0 12.75-8.675 21.375Q492.649-40 479.825-40zM240-678l-57-56q-9-9-8.629-21.603.37-12.604 8.526-21.5 8.896-8.897 21.5-8.897Q217-786 226-777l56 57q8 9 8 21t-8 20.5-20.5 8.5-21.5-8zm494 495-56-57q-8-9-8-21.375T678.5-282q8.5-9 20.5-9t21 9l57 56q9 9 8.629 21.603-.37 12.604-8.526 21.5-8.896 8.897-21.5 8.897Q743-174 734-183zm-56-495q-9-9-9-21t9-21l56-57q9-9 21.603-8.629 12.604.37 21.5 8.526 8.897 8.896 8.897 21.5Q786-743 777-734l-57 56q-8 8-20.364 8-12.363.0-21.636-8zM182.897-182.897q-8.897-8.896-8.897-21.5Q174-217 183-226l57-56q8.8-9 20.9-9 12.1.0 20.709 9Q291-273 291-261t-9 21l-56 57q-9 9-21.603 8.629-12.604-.37-21.5-8.526z"/></svg></span>
<span class="icon-svg hidden dark:block"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-120q-150 0-255-105T120-480q0-135 79.5-229T408-830q20-5 34-1t22 15q8 10 7.5 25t-8.5 35q-9 23-14 47t-5 49q0 90 63 153t153 63q25 0 48.5-4.5T754-461t38-7 26 9 13 23-2 36q-27 121-121 200.5T480-120z"/></svg></span></button></div></div></header><main class=flex><div id=sidebar class="sticky top-16 flex h-screen shrink-0 grow flex-row-reverse overflow-y-scroll bg-background-light dark:bg-gray-dark-100 md:fixed md:z-10 md:hidden md:h-screen md:w-screen lg:grow-0"><nav class="text-sm py-4 hidden gap-4 pl-4 md:flex flex-col justify-evenly"><div class="text-gray-light dark:text-gray-dark">Main sections</div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../../../get-started/overview/index.html">Guides</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../../../manuals/index.html">Manuals</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75
underline"><a href="../../../../../app/working-with-app/index.html">Reference</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../../../samples/index.html">Samples</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../../../faq/index.html">FAQ</a></div></nav><hr><nav id=sectiontree class="text-sm w-[300px] md:w-full flex flex-col"><div class="hidden md:block p-4 text-gray-light dark:text-gray-dark">This section</div><ul><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../app/working-with-app/index.html" title="Reference documentation"><span class="flex items-center gap-2">Reference documentation</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">CLI reference
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../index.html" title="docker (base command)"><span class="flex items-center gap-2">docker (base command)</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../build/index.html" title="docker build"><span class="flex items-center gap-2">docker build</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker builder
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../builder/index.html" title="docker builder"><span class="flex items-center gap-2">docker builder</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../builder/build/index.html" title="docker builder build"><span class="flex items-center gap-2">docker builder build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../builder/prune/index.html" title="docker builder prune"><span class="flex items-center gap-2">docker builder prune</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker buildx
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/index.html" title="docker buildx"><span class="flex items-center gap-2">docker buildx</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/bake/index.html" title="docker buildx bake"><span class="flex items-center gap-2">docker buildx bake</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/reference/commandline/buildx_build/index.html" title="docker buildx build"><span class="flex items-center gap-2">docker buildx build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/create/index.html" title="docker buildx create"><span class="flex items-center gap-2">docker buildx create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/debug/index.html" title="docker buildx debug"><span class="flex items-center gap-2">docker buildx debug</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/debug/build/index.html" title="docker buildx debug build"><span class="flex items-center gap-2">docker buildx debug build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/du/index.html" title="docker buildx du"><span class="flex items-center gap-2">docker buildx du</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/imagetools/index.html" title="docker buildx imagetools"><span class="flex items-center gap-2">docker buildx imagetools</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/imagetools/create/index.html" title="docker buildx imagetools create"><span class="flex items-center gap-2">docker buildx imagetools create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/imagetools/inspect/index.html" title="docker buildx imagetools inspect"><span class="flex items-center gap-2">docker buildx imagetools inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/inspect/index.html" title="docker buildx inspect"><span class="flex items-center gap-2">docker buildx inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/ls/index.html" title="docker buildx ls"><span class="flex items-center gap-2">docker buildx ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/prune/index.html" title="docker buildx prune"><span class="flex items-center gap-2">docker buildx prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/rm/index.html" title="docker buildx rm"><span class="flex items-center gap-2">docker buildx rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/stop/index.html" title="docker buildx stop"><span class="flex items-center gap-2">docker buildx stop</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/use/index.html" title="docker buildx use"><span class="flex items-center gap-2">docker buildx use</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../buildx/version/index.html" title="docker buildx version"><span class="flex items-center gap-2">docker buildx version</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker checkpoint
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../checkpoint/index.html" title="docker checkpoint"><span class="flex items-center gap-2">docker checkpoint</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../checkpoint/create/index.html" title="docker checkpoint create"><span class="flex items-center gap-2">docker checkpoint create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../checkpoint/ls/index.html" title="docker checkpoint ls"><span class="flex items-center gap-2">docker checkpoint ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../checkpoint/rm/index.html" title="docker checkpoint rm"><span class="flex items-center gap-2">docker checkpoint rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker compose
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/reference/index.html" title=overview><span class="flex items-center gap-2">overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/alpha/index.html" title="docker compose alpha"><span class="flex items-center gap-2">docker compose alpha</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/alpha/dry-run/index.html" title="docker compose alpha dry-run"><span class="flex items-center gap-2">docker compose alpha dry-run</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/alpha/publish/index.html" title="docker compose alpha publish"><span class="flex items-center gap-2">docker compose alpha publish</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/alpha/scale/index.html" title="docker compose alpha scale"><span class="flex items-center gap-2">docker compose alpha scale</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/alpha/viz/index.html" title="docker compose alpha viz"><span class="flex items-center gap-2">docker compose alpha viz</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/index.html" title="docker compose"><span class="flex items-center gap-2">docker compose</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/build/index.html" title="docker compose build"><span class="flex items-center gap-2">docker compose build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/config/index.html" title="docker compose config"><span class="flex items-center gap-2">docker compose config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/cp/index.html" title="docker compose cp"><span class="flex items-center gap-2">docker compose cp</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/create/index.html" title="docker compose create"><span class="flex items-center gap-2">docker compose create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/down/index.html" title="docker compose down"><span class="flex items-center gap-2">docker compose down</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/events/index.html" title="docker compose events"><span class="flex items-center gap-2">docker compose events</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/exec/index.html" title="docker compose exec"><span class="flex items-center gap-2">docker compose exec</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/images/index.html" title="docker compose images"><span class="flex items-center gap-2">docker compose images</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/kill/index.html" title="docker compose kill"><span class="flex items-center gap-2">docker compose kill</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/logs/index.html" title="docker compose logs"><span class="flex items-center gap-2">docker compose logs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/ls/index.html" title="docker compose ls"><span class="flex items-center gap-2">docker compose ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/pause/index.html" title="docker compose pause"><span class="flex items-center gap-2">docker compose pause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/port/index.html" title="docker compose port"><span class="flex items-center gap-2">docker compose port</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/ps/index.html" title="docker compose ps"><span class="flex items-center gap-2">docker compose ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/pull/index.html" title="docker compose pull"><span class="flex items-center gap-2">docker compose pull</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/push/index.html" title="docker compose push"><span class="flex items-center gap-2">docker compose push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/restart/index.html" title="docker compose restart"><span class="flex items-center gap-2">docker compose restart</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/rm/index.html" title="docker compose rm"><span class="flex items-center gap-2">docker compose rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/run/index.html" title="docker compose run"><span class="flex items-center gap-2">docker compose run</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/start/index.html" title="docker compose start"><span class="flex items-center gap-2">docker compose start</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/stop/index.html" title="docker compose stop"><span class="flex items-center gap-2">docker compose stop</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/top/index.html" title="docker compose top"><span class="flex items-center gap-2">docker compose top</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/unpause/index.html" title="docker compose unpause"><span class="flex items-center gap-2">docker compose unpause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/up/index.html" title="docker compose up"><span class="flex items-center gap-2">docker compose up</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/version/index.html" title="docker compose version"><span class="flex items-center gap-2">docker compose version</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/wait/index.html" title="docker compose wait"><span class="flex items-center gap-2">docker compose wait</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose/watch/index.html" title="docker compose watch"><span class="flex items-center gap-2">docker compose watch</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker config
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../config/index.html" title="docker config"><span class="flex items-center gap-2">docker config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../config/create/index.html" title="docker config create"><span class="flex items-center gap-2">docker config create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../config/inspect/index.html" title="docker config inspect"><span class="flex items-center gap-2">docker config inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../config/ls/index.html" title="docker config ls"><span class="flex items-center gap-2">docker config ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../config/rm/index.html" title="docker config rm"><span class="flex items-center gap-2">docker config rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker container
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../index.html" title="docker container"><span class="flex items-center gap-2">docker container</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../attach/index.html" title="docker container attach"><span class="flex items-center gap-2">docker container attach</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../commit/index.html" title="docker container commit"><span class="flex items-center gap-2">docker container commit</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../cp/index.html" title="docker container cp"><span class="flex items-center gap-2">docker container cp</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../create/index.html" title="docker container create"><span class="flex items-center gap-2">docker container create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../diff/index.html" title="docker container diff"><span class="flex items-center gap-2">docker container diff</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../exec/index.html" title="docker container exec"><span class="flex items-center gap-2">docker container exec</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../export/index.html" title="docker container export"><span class="flex items-center gap-2">docker container export</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../inspect/index.html" title="docker container inspect"><span class="flex items-center gap-2">docker container inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../kill/index.html" title="docker container kill"><span class="flex items-center gap-2">docker container kill</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../logs/index.html" title="docker container logs"><span class="flex items-center gap-2">docker container logs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../ps/index.html" title="docker container ls"><span class="flex items-center gap-2">docker container ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../pause/index.html" title="docker container pause"><span class="flex items-center gap-2">docker container pause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../port/index.html" title="docker container port"><span class="flex items-center gap-2">docker container port</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../prune/index.html" title="docker container prune"><span class="flex items-center gap-2">docker container prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../rename/index.html" title="docker container rename"><span class="flex items-center gap-2">docker container rename</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../restart/index.html" title="docker container restart"><span class="flex items-center gap-2">docker container restart</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../rm/index.html" title="docker container rm"><span class="flex items-center gap-2">docker container rm</span></a></li><li class="pl-4 sidebar-hover rounded
bg-gray-light-200 dark:bg-gray-dark-200"><a aria-current=page class="py-2 w-full truncate block" href="../../../../../engine/reference/commandline/run/index.html" title="docker container run"><span class="flex items-center gap-2">docker container run</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../start/index.html" title="docker container start"><span class="flex items-center gap-2">docker container start</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../stats/index.html" title="docker container stats"><span class="flex items-center gap-2">docker container stats</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../stop/index.html" title="docker container stop"><span class="flex items-center gap-2">docker container stop</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../top/index.html" title="docker container top"><span class="flex items-center gap-2">docker container top</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../unpause/index.html" title="docker container unpause"><span class="flex items-center gap-2">docker container unpause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../update/index.html" title="docker container update"><span class="flex items-center gap-2">docker container update</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../wait/index.html" title="docker container wait"><span class="flex items-center gap-2">docker container wait</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker context
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/index.html" title="docker context"><span class="flex items-center gap-2">docker context</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/create/index.html" title="docker context create"><span class="flex items-center gap-2">docker context create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/export/index.html" title="docker context export"><span class="flex items-center gap-2">docker context export</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/import/index.html" title="docker context import"><span class="flex items-center gap-2">docker context import</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/inspect/index.html" title="docker context inspect"><span class="flex items-center gap-2">docker context inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/ls/index.html" title="docker context ls"><span class="flex items-center gap-2">docker context ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/rm/index.html" title="docker context rm"><span class="flex items-center gap-2">docker context rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/show/index.html" title="docker context show"><span class="flex items-center gap-2">docker context show</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/update/index.html" title="docker context update"><span class="flex items-center gap-2">docker context update</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../context/use/index.html" title="docker context use"><span class="flex items-center gap-2">docker context use</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../debug/index.html" title="docker debug (Beta)"><span class="flex items-center gap-2">docker debug (Beta)</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../exec/index.html" title="docker exec"><span class="flex items-center gap-2">docker exec</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker image
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/index.html" title="docker image"><span class="flex items-center gap-2">docker image</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../builder/build/index.html" title="docker image build"><span class="flex items-center gap-2">docker image build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/history/index.html" title="docker image history"><span class="flex items-center gap-2">docker image history</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/import/index.html" title="docker image import"><span class="flex items-center gap-2">docker image import</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/inspect/index.html" title="docker image inspect"><span class="flex items-center gap-2">docker image inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/load/index.html" title="docker image load"><span class="flex items-center gap-2">docker image load</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../images/index.html" title="docker image ls"><span class="flex items-center gap-2">docker image ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/prune/index.html" title="docker image prune"><span class="flex items-center gap-2">docker image prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../pull/index.html" title="docker image pull"><span class="flex items-center gap-2">docker image pull</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../push/index.html" title="docker image push"><span class="flex items-center gap-2">docker image push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/rm/index.html" title="docker image rm"><span class="flex items-center gap-2">docker image rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/save/index.html" title="docker image save"><span class="flex items-center gap-2">docker image save</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../image/tag/index.html" title="docker image tag"><span class="flex items-center gap-2">docker image tag</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../images/index.html" title="docker images"><span class="flex items-center gap-2">docker images</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../info/index.html" title="docker info"><span class="flex items-center gap-2">docker info</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../init/index.html" title="docker init"><span class="flex items-center gap-2">docker init</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../inspect/index.html" title="docker inspect"><span class="flex items-center gap-2">docker inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../login/index.html" title="docker login"><span class="flex items-center gap-2">docker login</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../logout/index.html" title="docker logout"><span class="flex items-center gap-2">docker logout</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker manifest
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../manifest/index.html" title="docker manifest"><span class="flex items-center gap-2">docker manifest</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../manifest/annotate/index.html" title="docker manifest annotate"><span class="flex items-center gap-2">docker manifest annotate</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../manifest/create/index.html" title="docker manifest create"><span class="flex items-center gap-2">docker manifest create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../manifest/inspect/index.html" title="docker manifest inspect"><span class="flex items-center gap-2">docker manifest inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../manifest/push/index.html" title="docker manifest push"><span class="flex items-center gap-2">docker manifest push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../manifest/rm/index.html" title="docker manifest rm"><span class="flex items-center gap-2">docker manifest rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker network
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/index.html" title="docker network"><span class="flex items-center gap-2">docker network</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/connect/index.html" title="docker network connect"><span class="flex items-center gap-2">docker network connect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/create/index.html" title="docker network create"><span class="flex items-center gap-2">docker network create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/disconnect/index.html" title="docker network disconnect"><span class="flex items-center gap-2">docker network disconnect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/inspect/index.html" title="docker network inspect"><span class="flex items-center gap-2">docker network inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/ls/index.html" title="docker network ls"><span class="flex items-center gap-2">docker network ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/prune/index.html" title="docker network prune"><span class="flex items-center gap-2">docker network prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../network/rm/index.html" title="docker network rm"><span class="flex items-center gap-2">docker network rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker node
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/index.html" title="docker node"><span class="flex items-center gap-2">docker node</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/demote/index.html" title="docker node demote"><span class="flex items-center gap-2">docker node demote</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/inspect/index.html" title="docker node inspect"><span class="flex items-center gap-2">docker node inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/ls/index.html" title="docker node ls"><span class="flex items-center gap-2">docker node ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/promote/index.html" title="docker node promote"><span class="flex items-center gap-2">docker node promote</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/ps/index.html" title="docker node ps"><span class="flex items-center gap-2">docker node ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/rm/index.html" title="docker node rm"><span class="flex items-center gap-2">docker node rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../node/update/index.html" title="docker node update"><span class="flex items-center gap-2">docker node update</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker plugin
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/index.html" title="docker plugin"><span class="flex items-center gap-2">docker plugin</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/create/index.html" title="docker plugin create"><span class="flex items-center gap-2">docker plugin create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/disable/index.html" title="docker plugin disable"><span class="flex items-center gap-2">docker plugin disable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/enable/index.html" title="docker plugin enable"><span class="flex items-center gap-2">docker plugin enable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/inspect/index.html" title="docker plugin inspect"><span class="flex items-center gap-2">docker plugin inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/install/index.html" title="docker plugin install"><span class="flex items-center gap-2">docker plugin install</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/ls/index.html" title="docker plugin ls"><span class="flex items-center gap-2">docker plugin ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/rm/index.html" title="docker plugin rm"><span class="flex items-center gap-2">docker plugin rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/set/index.html" title="docker plugin set"><span class="flex items-center gap-2">docker plugin set</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../plugin/upgrade/index.html" title="docker plugin upgrade"><span class="flex items-center gap-2">docker plugin upgrade</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../ps/index.html" title="docker ps"><span class="flex items-center gap-2">docker ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../pull/index.html" title="docker pull"><span class="flex items-center gap-2">docker pull</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../push/index.html" title="docker push"><span class="flex items-center gap-2">docker push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../run/index.html" title="docker run"><span class="flex items-center gap-2">docker run</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker scout
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/index.html" title="docker scout"><span class="flex items-center gap-2">docker scout</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/attestation/index.html" title="docker scout attestation"><span class="flex items-center gap-2">docker scout attestation</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/attestation/add/index.html" title="docker scout attestation add"><span class="flex items-center gap-2">docker scout attestation add</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/cache/index.html" title="docker scout cache"><span class="flex items-center gap-2">docker scout cache</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/cache/df/index.html" title="docker scout cache df"><span class="flex items-center gap-2">docker scout cache df</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/cache/prune/index.html" title="docker scout cache prune"><span class="flex items-center gap-2">docker scout cache prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/compare/index.html" title="docker scout compare"><span class="flex items-center gap-2">docker scout compare</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/config/index.html" title="docker scout config"><span class="flex items-center gap-2">docker scout config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/cves.html" title="docker scout cves"><span class="flex items-center gap-2">docker scout cves</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/enroll/index.html" title="docker scout enroll"><span class="flex items-center gap-2">docker scout enroll</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/environment/index.html" title="docker scout environment"><span class="flex items-center gap-2">docker scout environment</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/integration/index.html" title="docker scout integration"><span class="flex items-center gap-2">docker scout integration</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/integration/configure/index.html" title="docker scout integration configure"><span class="flex items-center gap-2">docker scout integration configure</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/integration/delete/index.html" title="docker scout integration delete"><span class="flex items-center gap-2">docker scout integration delete</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/integration/list/index.html" title="docker scout integration list"><span class="flex items-center gap-2">docker scout integration list</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/policy/index.html" title="docker scout policy"><span class="flex items-center gap-2">docker scout policy</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/quickview/index.html" title="docker scout quickview"><span class="flex items-center gap-2">docker scout quickview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/recommendations/index.html" title="docker scout recommendations"><span class="flex items-center gap-2">docker scout recommendations</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/repo/index.html" title="docker scout repo"><span class="flex items-center gap-2">docker scout repo</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/repo/disable/index.html" title="docker scout repo disable"><span class="flex items-center gap-2">docker scout repo disable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/repo/enable.html" title="docker scout repo enable"><span class="flex items-center gap-2">docker scout repo enable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/repo/list/index.html" title="docker scout repo list"><span class="flex items-center gap-2">docker scout repo list</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/sbom/index.html" title="docker scout sbom"><span class="flex items-center gap-2">docker scout sbom</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/stream/index.html" title="docker scout stream"><span class="flex items-center gap-2">docker scout stream</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/version/index.html" title="docker scout version"><span class="flex items-center gap-2">docker scout version</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../scout/watch/index.html" title="docker scout watch"><span class="flex items-center gap-2">docker scout watch</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../search/index.html" title="docker search"><span class="flex items-center gap-2">docker search</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker secret
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../secret/index.html" title="docker secret"><span class="flex items-center gap-2">docker secret</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../secret/create/index.html" title="docker secret create"><span class="flex items-center gap-2">docker secret create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../secret/inspect/index.html" title="docker secret inspect"><span class="flex items-center gap-2">docker secret inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../secret/ls/index.html" title="docker secret ls"><span class="flex items-center gap-2">docker secret ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../secret/rm/index.html" title="docker secret rm"><span class="flex items-center gap-2">docker secret rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker service
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/index.html" title="docker service"><span class="flex items-center gap-2">docker service</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/create/index.html" title="docker service create"><span class="flex items-center gap-2">docker service create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/inspect/index.html" title="docker service inspect"><span class="flex items-center gap-2">docker service inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/logs/index.html" title="docker service logs"><span class="flex items-center gap-2">docker service logs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/ls/index.html" title="docker service ls"><span class="flex items-center gap-2">docker service ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/ps/index.html" title="docker service ps"><span class="flex items-center gap-2">docker service ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/rollback/index.html" title="docker service rollback"><span class="flex items-center gap-2">docker service rollback</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/rm/index.html" title="docker service rm"><span class="flex items-center gap-2">docker service rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/scale/index.html" title="docker service scale"><span class="flex items-center gap-2">docker service scale</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../service/update/index.html" title="docker service update"><span class="flex items-center gap-2">docker service update</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker stack
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../stack/index.html" title="docker stack"><span class="flex items-center gap-2">docker stack</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../stack/config/index.html" title="docker stack config"><span class="flex items-center gap-2">docker stack config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../stack/deploy/index.html" title="docker stack deploy"><span class="flex items-center gap-2">docker stack deploy</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../stack/ls/index.html" title="docker stack ls"><span class="flex items-center gap-2">docker stack ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../stack/ps/index.html" title="docker stack ps"><span class="flex items-center gap-2">docker stack ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../stack/rm/index.html" title="docker stack rm"><span class="flex items-center gap-2">docker stack rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../stack/services/index.html" title="docker stack services"><span class="flex items-center gap-2">docker stack services</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker swarm
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/index.html" title="docker swarm"><span class="flex items-center gap-2">docker swarm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/ca/index.html" title="docker swarm ca"><span class="flex items-center gap-2">docker swarm ca</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/init/index.html" title="docker swarm init"><span class="flex items-center gap-2">docker swarm init</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/join-token/index.html" title="docker swarm join-token"><span class="flex items-center gap-2">docker swarm join-token</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/join/index.html" title="docker swarm join"><span class="flex items-center gap-2">docker swarm join</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/leave/index.html" title="docker swarm leave"><span class="flex items-center gap-2">docker swarm leave</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/unlock-key/index.html" title="docker swarm unlock-key"><span class="flex items-center gap-2">docker swarm unlock-key</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/unlock/index.html" title="docker swarm unlock"><span class="flex items-center gap-2">docker swarm unlock</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../swarm/update/index.html" title="docker swarm update"><span class="flex items-center gap-2">docker swarm update</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker system
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../system/index.html" title="docker system"><span class="flex items-center gap-2">docker system</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../system/df/index.html" title="docker system df"><span class="flex items-center gap-2">docker system df</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../system/events/index.html" title="docker system events"><span class="flex items-center gap-2">docker system events</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../info/index.html" title="docker system info"><span class="flex items-center gap-2">docker system info</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../system/prune/index.html" title="docker system prune"><span class="flex items-center gap-2">docker system prune</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker trust
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/index.html" title="docker trust"><span class="flex items-center gap-2">docker trust</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/inspect/index.html" title="docker trust inspect"><span class="flex items-center gap-2">docker trust inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/key/index.html" title="docker trust key"><span class="flex items-center gap-2">docker trust key</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/key/generate/index.html" title="docker trust key generate"><span class="flex items-center gap-2">docker trust key generate</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/key/load/index.html" title="docker trust key load"><span class="flex items-center gap-2">docker trust key load</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/revoke/index.html" title="docker trust revoke"><span class="flex items-center gap-2">docker trust revoke</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/sign/index.html" title="docker trust sign"><span class="flex items-center gap-2">docker trust sign</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/signer/index.html" title="docker trust signer"><span class="flex items-center gap-2">docker trust signer</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/signer/add/index.html" title="docker trust signer add"><span class="flex items-center gap-2">docker trust signer add</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../trust/signer/remove/index.html" title="docker trust signer remove"><span class="flex items-center gap-2">docker trust signer remove</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../version/index.html" title="docker version"><span class="flex items-center gap-2">docker version</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker volume
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../volume/create/index.html" title="docker volume create"><span class="flex items-center gap-2">docker volume create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../volume/inspect/index.html" title="docker volume inspect"><span class="flex items-center gap-2">docker volume inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../volume/ls/index.html" title="docker volume ls"><span class="flex items-center gap-2">docker volume ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../volume/prune/index.html" title="docker volume prune"><span class="flex items-center gap-2">docker volume prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../volume/rm/index.html" title="docker volume rm"><span class="flex items-center gap-2">docker volume rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../volume/update/index.html" title="docker volume update"><span class="flex items-center gap-2">docker volume update</span></a></li></ul></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/reference/builder/index.html" title="Dockerfile reference"><span class="flex items-center gap-2">Dockerfile reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/reference/commandline/dockerd/index.html" title="Daemon CLI (dockerd)"><span class="flex items-center gap-2">Daemon CLI (dockerd)</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">API reference
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Docker Engine API
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/index.html" title=Overview><span class="flex items-center gap-2">Overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/sdk/index.html" title=SDKs><span class="flex items-center gap-2">SDKs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/sdk/examples/index.html" title="SDK examples"><span class="flex items-center gap-2">SDK examples</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/latest/index.html" title="v1.44 reference (latest)"><span class="flex items-center gap-2">v1.44 reference (latest)</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">API reference by version
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/version-history/index.html" title="Version history overview"><span class="flex items-center gap-2">Version history overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.42/index.html" title="v1.42 reference"><span class="flex items-center gap-2">v1.42 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.41/index.html" title="v1.41 reference"><span class="flex items-center gap-2">v1.41 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.40/index.html" title="v1.40 reference"><span class="flex items-center gap-2">v1.40 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.39/index.html" title="v1.39 reference"><span class="flex items-center gap-2">v1.39 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.38/index.html" title="v1.38 reference"><span class="flex items-center gap-2">v1.38 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.37/index.html" title="v1.37 reference"><span class="flex items-center gap-2">v1.37 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.36/index.html" title="v1.36 reference"><span class="flex items-center gap-2">v1.36 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.35/index.html" title="v1.35 reference"><span class="flex items-center gap-2">v1.35 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.34/index.html" title="v1.34 reference"><span class="flex items-center gap-2">v1.34 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.33/index.html" title="v1.33 reference"><span class="flex items-center gap-2">v1.33 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.32/index.html" title="v1.32 Reference"><span class="flex items-center gap-2">v1.32 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.31/index.html" title="v1.31 Reference"><span class="flex items-center gap-2">v1.31 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.30/index.html" title="v1.30 Reference"><span class="flex items-center gap-2">v1.30 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.29/index.html" title="v1.29 Reference"><span class="flex items-center gap-2">v1.29 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.28/index.html" title="v1.28 reference"><span class="flex items-center gap-2">v1.28 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.27/index.html" title="v1.27 reference"><span class="flex items-center gap-2">v1.27 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.26/index.html" title="v1.26 reference"><span class="flex items-center gap-2">v1.26 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.25/index.html" title="v1.25 reference"><span class="flex items-center gap-2">v1.25 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../engine/api/v1.24/index.html" title="v1.24 reference"><span class="flex items-center gap-2">v1.24 reference</span></a></li></ul></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Docker Hub API
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../docker-hub/api/latest/index.html" title="Docker Hub API"><span class="flex items-center gap-2">Docker Hub API</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../docker-hub/api/dvp/index.html" title="DVP Data API"><span class="flex items-center gap-2">DVP Data API</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../docker-hub/api/deprecated/index.html" title="Deprecated API"><span class="flex items-center gap-2">Deprecated API</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Docker Extension SDK API
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/DesktopUI/index.html" title=DesktopUI><span class="flex items-center gap-2">DesktopUI</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/Dialog/index.html" title=Dialog><span class="flex items-center gap-2">Dialog</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/Docker/index.html" title=Docker><span class="flex items-center gap-2">Docker</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/DockerCommand/index.html" title=DockerCommand><span class="flex items-center gap-2">DockerCommand</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/DockerDesktopClient/index.html" title=DockerDesktopClient><span class="flex items-center gap-2">DockerDesktopClient</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/Exec/index.html" title=Exec><span class="flex items-center gap-2">Exec</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecProcess/index.html" title=ExecProcess><span class="flex items-center gap-2">ExecProcess</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecResult/index.html" title=ExecResult><span class="flex items-center gap-2">ExecResult</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecStreamOptions/index.html" title=ExecStreamOptions><span class="flex items-center gap-2">ExecStreamOptions</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/Extension/index.html" title=Extension><span class="flex items-center gap-2">Extension</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExtensionCli/index.html" title=ExtensionCli><span class="flex items-center gap-2">ExtensionCli</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExtensionHost/index.html" title=ExtensionHost><span class="flex items-center gap-2">ExtensionHost</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExtensionVM/index.html" title=ExtensionVM><span class="flex items-center gap-2">ExtensionVM</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/Host/index.html" title=Host><span class="flex items-center gap-2">Host</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/HttpService/index.html" title=HttpService><span class="flex items-center gap-2">HttpService</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/NavigationIntents/index.html" title=NavigationIntents><span class="flex items-center gap-2">NavigationIntents</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/OpenDialogResult/index.html" title=OpenDialogResult><span class="flex items-center gap-2">OpenDialogResult</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/RawExecResult/index.html" title=RawExecResult><span class="flex items-center gap-2">RawExecResult</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/RequestConfig/index.html" title=RequestConfig><span class="flex items-center gap-2">RequestConfig</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/RequestConfigV0/index.html" title=RequestConfigV0><span class="flex items-center gap-2">RequestConfigV0</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/Toast/index.html" title=Toast><span class="flex items-center gap-2">Toast</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecResultV0/index.html" title=ExecResultV0><span class="flex items-center gap-2">ExecResultV0</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../desktop/extensions-sdk/dev/api/reference/interfaces/BackendV0/index.html" title=BackendV0><span class="flex items-center gap-2">BackendV0</span></a></li></ul></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Compose file reference
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Compose Specification
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file.html" title=Overview><span class="flex items-center gap-2">Overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/04-version-and-name/index.html" title="Version and name top-level element"><span class="flex items-center gap-2">Version and name top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/05-services/index.html" title="Services top-level element"><span class="flex items-center gap-2">Services top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/06-networks/index.html" title="Network top-level element"><span class="flex items-center gap-2">Network top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/07-volumes/index.html" title="Volumes top-level element"><span class="flex items-center gap-2">Volumes top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/08-configs/index.html" title="Configs top-level element"><span class="flex items-center gap-2">Configs top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/09-secrets/index.html" title="Secrets top-level element"><span class="flex items-center gap-2">Secrets top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/10-fragments/index.html" title=Fragments><span class="flex items-center gap-2">Fragments</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/11-extension/index.html" title=Extensions><span class="flex items-center gap-2">Extensions</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/12-interpolation/index.html" title=Interpolation><span class="flex items-center gap-2">Interpolation</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/13-merge/index.html" title=Merge><span class="flex items-center gap-2">Merge</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/14-include/index.html" title=Include><span class="flex items-center gap-2">Include</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/15-profiles/index.html" title=Profiles><span class="flex items-center gap-2">Profiles</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/build/index.html" title="Compose Build Specification"><span class="flex items-center gap-2">Compose Build Specification</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/deploy/index.html" title="Compose Deploy Specification"><span class="flex items-center gap-2">Compose Deploy Specification</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/develop/index.html" title="Compose Develop Specification"><span class="flex items-center gap-2">Compose Develop Specification</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Legacy versions
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/compose-versioning/index.html" title="About versions and upgrading"><span class="flex items-center gap-2">About versions and upgrading</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/compose-file-v3/index.html" title="Version 3"><span class="flex items-center gap-2">Version 3</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../compose/compose-file/compose-file-v2/index.html" title="Version 2"><span class="flex items-center gap-2">Version 2</span></a></li></ul></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../../../glossary/index.html" title=Glossary><span class="flex items-center gap-2">Glossary</span></a></li></ul></nav></div><div class="w-[840px] flex-initial overflow-clip p-6 pt-0 md:w-lvw"><nav id=breadcrumbs class="py-4 gap-4 flex items-center text-gray-light dark:text-gray-dark max-w-full min-w-0"><a href="../../../../../app/working-with-app/index.html" class="link truncate">Reference</a><span>/</span><a href="../../index.html" class="link truncate">CLI reference</a><span>/</span><a href="../index.html" class="link truncate">docker container</a><span>/</span>
<span class=truncate>docker container run</span></nav><article class="DocSearch-content prose max-w-none dark:prose-invert"><h1 class=scroll-mt-36>docker container run</h1><table><tbody><tr><th class="text-left w-32">Description</th><td>Create and run a new container from an image</th></tr><tr><th class="text-left w-32">Usage</th><td><code>docker container run [OPTIONS] IMAGE [COMMAND] [ARG...]</code></td></tr><tr><th class="text-left w-32 flex items-center gap-2"><span>Aliases</span><div data-tooltip-wrapper><div data-tooltip-button class="icon-svg icon-sm flex items-center text-blue-light dark:text-blue-dark"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M484.028-247Q5e2-247 511-258.028t11-27T510.972-312t-27-11T457-311.972t-11 27T457.028-258t27 11zm-3.762 167q-82.734.0-155.5-31.5t-127.266-86-86-127.341Q80-397.681 80-480.5t31.5-155.659Q143-709 197.5-763t127.341-85.5Q397.681-880 480.5-880t155.659 31.5Q709-817 763-763t85.5 127T880-480.266t-31.5 155.5T763-197.684t-127 86T480.266-80zm2.501-580Q513-660 536-641.5t23 47.196q0 26.304-15.648 45.733Q527.705-529.143 508-512q-23 19-40 42.385-17 23.384-17 52.615.0 11 8.4 17.5T479-393q12 0 19.875-8T509-421q3-21 16-38t30.231-30.784Q580-510 596-537t16-58.614Q612-646 574.5-679.5T485.548-713Q450-713 417-698t-54 44q-7 10-6.5 21.5t9.469 18.5q11.416 8 23.646 5 12.231-3 20.385-14 12.75-17.903 31.875-27.452Q461-660 482.767-660z"/></svg></div><div data-tooltip-body class="absolute left-0 top-0 hidden max-w-56 rounded bg-accent-light p-2 text-white dark:bg-accent-dark" role=tooltip>An alias is a short or memorable alternative for a longer command.<div data-tooltip-arrow class="absolute h-2 w-2 rotate-45 bg-accent-light dark:bg-accent-dark"></div></div></div></th><td><div class="flex gap-3"><code>docker run</code></div></td></tr></tbody></table><h2 class=scroll-mt-20 id=description><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#description">Description</a></h2><p>The <code>docker run</code> command runs a command in a new container, pulling the image if needed and starting the container.</p><p>You can restart a stopped container with all its previous changes intact using <code>docker start</code>.
Use <code>docker ps -a</code> to view a list of all containers, including those that are stopped.</p><h2 class=scroll-mt-20 id=options><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#options">Options</a></h2><table><thead><tr><th>Option</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#add-host"><code>--add-host</code></a></td><td></td><td>Add a custom host-to-IP mapping (host:ip)</td></tr><tr><td><code>--annotation</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.43+</span>
Add an annotation to the container (passed through to the OCI runtime)<br></td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#attach"><code>-a, --attach</code></a></td><td></td><td>Attach to STDIN, STDOUT or STDERR</td></tr><tr><td><code>--blkio-weight</code></td><td></td><td>Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)<br></td></tr><tr><td><code>--blkio-weight-device</code></td><td></td><td>Block IO weight (relative device weight)</td></tr><tr><td><code>--cap-add</code></td><td></td><td>Add Linux capabilities</td></tr><tr><td><code>--cap-drop</code></td><td></td><td>Drop Linux capabilities</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#cgroup-parent"><code>--cgroup-parent</code></a></td><td></td><td>Optional parent cgroup for the container</td></tr><tr><td><code>--cgroupns</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.41+</span>
Cgroup namespace to use (host|private)<br>'host': Run the container in the Docker host's cgroup namespace<br>'private': Run the container in its own private cgroup namespace<br>'': Use the cgroup namespace as configured by the<br>default-cgroupns-mode option on the daemon (default)</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#cidfile"><code>--cidfile</code></a></td><td></td><td>Write the container ID to the file</td></tr><tr><td><code>--cpu-count</code></td><td></td><td>CPU count (Windows only)</td></tr><tr><td><code>--cpu-percent</code></td><td></td><td>CPU percent (Windows only)</td></tr><tr><td><code>--cpu-period</code></td><td></td><td>Limit CPU CFS (Completely Fair Scheduler) period</td></tr><tr><td><code>--cpu-quota</code></td><td></td><td>Limit CPU CFS (Completely Fair Scheduler) quota</td></tr><tr><td><code>--cpu-rt-period</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.25+</span>
Limit CPU real-time period in microseconds</td></tr><tr><td><code>--cpu-rt-runtime</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.25+</span>
Limit CPU real-time runtime in microseconds</td></tr><tr><td><code>-c, --cpu-shares</code></td><td></td><td>CPU shares (relative weight)</td></tr><tr><td><code>--cpus</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.25+</span>
Number of CPUs</td></tr><tr><td><code>--cpuset-cpus</code></td><td></td><td>CPUs in which to allow execution (0-3, 0,1)</td></tr><tr><td><code>--cpuset-mems</code></td><td></td><td>MEMs in which to allow execution (0-3, 0,1)</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#detach"><code>-d, --detach</code></a></td><td></td><td>Run container in background and print container ID</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#detach-keys"><code>--detach-keys</code></a></td><td></td><td>Override the key sequence for detaching a container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#device"><code>--device</code></a></td><td></td><td>Add a host device to the container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#device-cgroup-rule"><code>--device-cgroup-rule</code></a></td><td></td><td>Add a rule to the cgroup allowed devices list</td></tr><tr><td><code>--device-read-bps</code></td><td></td><td>Limit read rate (bytes per second) from a device</td></tr><tr><td><code>--device-read-iops</code></td><td></td><td>Limit read rate (IO per second) from a device</td></tr><tr><td><code>--device-write-bps</code></td><td></td><td>Limit write rate (bytes per second) to a device</td></tr><tr><td><code>--device-write-iops</code></td><td></td><td>Limit write rate (IO per second) to a device</td></tr><tr><td><code>--disable-content-trust</code></td><td><code>true</code></td><td>Skip image verification</td></tr><tr><td><code>--dns</code></td><td></td><td>Set custom DNS servers</td></tr><tr><td><code>--dns-option</code></td><td></td><td>Set DNS options</td></tr><tr><td><code>--dns-search</code></td><td></td><td>Set custom DNS search domains</td></tr><tr><td><code>--domainname</code></td><td></td><td>Container NIS domain name</td></tr><tr><td><code>--entrypoint</code></td><td></td><td>Overwrite the default ENTRYPOINT of the image</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#env"><code>-e, --env</code></a></td><td></td><td>Set environment variables</td></tr><tr><td><code>--env-file</code></td><td></td><td>Read in a file of environment variables</td></tr><tr><td><code>--expose</code></td><td></td><td>Expose a port or a range of ports</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#gpus"><code>--gpus</code></a></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.40+</span>
GPU devices to add to the container ('all' to pass all GPUs)</td></tr><tr><td><code>--group-add</code></td><td></td><td>Add additional groups to join</td></tr><tr><td><code>--health-cmd</code></td><td></td><td>Command to run to check health</td></tr><tr><td><code>--health-interval</code></td><td></td><td>Time between running the check (ms|s|m|h) (default 0s)</td></tr><tr><td><code>--health-retries</code></td><td></td><td>Consecutive failures needed to report unhealthy</td></tr><tr><td><code>--health-start-interval</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.44+</span>
Time between running the check during the start period (ms|s|m|h) (default 0s)<br></td></tr><tr><td><code>--health-start-period</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.29+</span>
Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s)<br></td></tr><tr><td><code>--health-timeout</code></td><td></td><td>Maximum time to allow one check to run (ms|s|m|h) (default 0s)</td></tr><tr><td><code>--help</code></td><td></td><td>Print usage</td></tr><tr><td><code>-h, --hostname</code></td><td></td><td>Container host name</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#init"><code>--init</code></a></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.25+</span>
Run an init inside the container that forwards signals and reaps processes<br></td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#interactive"><code>-i, --interactive</code></a></td><td></td><td>Keep STDIN open even if not attached</td></tr><tr><td><code>--io-maxbandwidth</code></td><td></td><td>Maximum IO bandwidth limit for the system drive (Windows only)</td></tr><tr><td><code>--io-maxiops</code></td><td></td><td>Maximum IOps limit for the system drive (Windows only)</td></tr><tr><td><code>--ip</code></td><td></td><td>IPv4 address (e.g., 172.30.100.104)</td></tr><tr><td><code>--ip6</code></td><td></td><td>IPv6 address (e.g., 2001:db8::33)</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#ipc"><code>--ipc</code></a></td><td></td><td>IPC mode to use</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#isolation"><code>--isolation</code></a></td><td></td><td>Container isolation technology</td></tr><tr><td><code>--kernel-memory</code></td><td></td><td>Kernel memory limit</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#label"><code>-l, --label</code></a></td><td></td><td>Set meta data on a container</td></tr><tr><td><code>--label-file</code></td><td></td><td>Read in a line delimited file of labels</td></tr><tr><td><code>--link</code></td><td></td><td>Add link to another container</td></tr><tr><td><code>--link-local-ip</code></td><td></td><td>Container IPv4/IPv6 link-local addresses</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#log-driver"><code>--log-driver</code></a></td><td></td><td>Logging driver for the container</td></tr><tr><td><code>--log-opt</code></td><td></td><td>Log driver options</td></tr><tr><td><code>--mac-address</code></td><td></td><td>Container MAC address (e.g., 92:d0:c6:0a:29:33)</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#memory"><code>-m, --memory</code></a></td><td></td><td>Memory limit</td></tr><tr><td><code>--memory-reservation</code></td><td></td><td>Memory soft limit</td></tr><tr><td><code>--memory-swap</code></td><td></td><td>Swap limit equal to memory plus swap: '-1' to enable unlimited swap<br></td></tr><tr><td><code>--memory-swappiness</code></td><td><code>-1</code></td><td>Tune container memory swappiness (0 to 100)</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#mount"><code>--mount</code></a></td><td></td><td>Attach a filesystem mount to the container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#name"><code>--name</code></a></td><td></td><td>Assign a name to the container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#network"><code>--network</code></a></td><td></td><td>Connect a container to a network</td></tr><tr><td><code>--network-alias</code></td><td></td><td>Add network-scoped alias for the container</td></tr><tr><td><code>--no-healthcheck</code></td><td></td><td>Disable any container-specified HEALTHCHECK</td></tr><tr><td><code>--oom-kill-disable</code></td><td></td><td>Disable OOM Killer</td></tr><tr><td><code>--oom-score-adj</code></td><td></td><td>Tune host's OOM preferences (-1000 to 1000)</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#pid"><code>--pid</code></a></td><td></td><td>PID namespace to use</td></tr><tr><td><code>--pids-limit</code></td><td></td><td>Tune container pids limit (set -1 for unlimited)</td></tr><tr><td><code>--platform</code></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.32+</span>
Set platform if server is multi-platform capable</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#privileged"><code>--privileged</code></a></td><td></td><td>Give extended privileges to this container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#publish"><code>-p, --publish</code></a></td><td></td><td>Publish a container's port(s) to the host</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#publish-all"><code>-P, --publish-all</code></a></td><td></td><td>Publish all exposed ports to random ports</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#pull"><code>--pull</code></a></td><td><code>missing</code></td><td>Pull image before running (<code>always</code>, <code>missing</code>, <code>never</code>)</td></tr><tr><td><code>-q, --quiet</code></td><td></td><td>Suppress the pull output</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#read-only"><code>--read-only</code></a></td><td></td><td>Mount the container's root filesystem as read only</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#restart"><code>--restart</code></a></td><td><code>no</code></td><td>Restart policy to apply when a container exits</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#rm"><code>--rm</code></a></td><td></td><td>Automatically remove the container when it exits</td></tr><tr><td><code>--runtime</code></td><td></td><td>Runtime to use for this container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#security-opt"><code>--security-opt</code></a></td><td></td><td>Security Options</td></tr><tr><td><code>--shm-size</code></td><td></td><td>Size of /dev/shm</td></tr><tr><td><code>--sig-proxy</code></td><td><code>true</code></td><td>Proxy received signals to the process</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#stop-signal"><code>--stop-signal</code></a></td><td></td><td>Signal to stop the container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#stop-timeout"><code>--stop-timeout</code></a></td><td></td><td><span class="not-prose px-1 rounded-sm bg-blue-light dark:bg-blue-dark text-white text-xs">API 1.25+</span>
Timeout (in seconds) to stop a container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#storage-opt"><code>--storage-opt</code></a></td><td></td><td>Storage driver options for the container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#sysctl"><code>--sysctl</code></a></td><td></td><td>Sysctl options</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#tmpfs"><code>--tmpfs</code></a></td><td></td><td>Mount a tmpfs directory</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#tty"><code>-t, --tty</code></a></td><td></td><td>Allocate a pseudo-TTY</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#ulimit"><code>--ulimit</code></a></td><td></td><td>Ulimit options</td></tr><tr><td><code>-u, --user</code></td><td></td><td>Username or UID (format: &lt;name|uid>[:&lt;group|gid>])</td></tr><tr><td><code>--userns</code></td><td></td><td>User namespace to use</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#uts"><code>--uts</code></a></td><td></td><td>UTS namespace to use</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#volume"><code>-v, --volume</code></a></td><td></td><td>Bind mount a volume</td></tr><tr><td><code>--volume-driver</code></td><td></td><td>Optional volume driver for the container</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#volumes-from"><code>--volumes-from</code></a></td><td></td><td>Mount volumes from the specified container(s)</td></tr><tr><td><a class=link href="../../../../../engine/reference/commandline/run/index.html#workdir"><code>-w, --workdir</code></a></td><td></td><td>Working directory inside the container</td></tr></tbody></table><h2 class=scroll-mt-20 id=examples><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#examples">Examples</a></h2><h3 class=scroll-mt-20 id=name><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#name">Assign name (--name)</a></h3><p>The <code>--name</code> flag lets you specify a custom identifier for a container. The
following example runs a container named <code>test</code> using the <code>nginx:alpine</code> image
in
<a class=link href="../../../../../engine/reference/commandline/run/index.html#detach">detached mode</a>.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tbmFtZSB0ZXN0IC1kIG5naW54OmFscGluZQo0YmVkNzZkM2FkNDI4Yjg4OWM1NmMxZWNjMmJmMmVkOTVjYjA4MjU2ZGIyMmRjNWVmNTg2M2UxZDAzMjUyYTE5CiQgZG9ja2VyIHBzCkNPTlRBSU5FUiBJRCAgIElNQUdFICAgICAgICAgIENPTU1BTkQgICAgICAgICAgICAgICAgICBDUkVBVEVEICAgICAgICBTVEFUVVMgICAgICAgICAgICAgICAgICBQT1JUUyAgICAgTkFNRVMKNGJlZDc2ZDNhZDQyICAgbmdpbng6YWxwaW5lICAgIi9kb2NrZXItZW50cnlwb2ludC7igKYiICAgMSBzZWNvbmQgYWdvICAgVXAgTGVzcyB0aGFuIGEgc2Vjb25kICAgODAvdGNwICAgIHRlc3Q=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --name <span class=nb>test</span> -d nginx:alpine
</span></span><span class=line><span class=cl><span class=go>4bed76d3ad428b889c56c1ecc2bf2ed95cb08256db22dc5ef5863e1d03252a19
</span></span></span><span class=line><span class=cl><span class=go></span><span class=gp>$</span> docker ps
</span></span><span class=line><span class=cl><span class=go>CONTAINER ID   IMAGE          COMMAND                  CREATED        STATUS                  PORTS     NAMES
</span></span></span><span class=line><span class=cl><span class=go>4bed76d3ad42   nginx:alpine   &#34;/docker-entrypoint.…&#34;   1 second ago   Up Less than a second   80/tcp    test
</span></span></span></code></pre></div></div></div><p>You can reference the container by name with other commands. For example, the
following commands stop and remove a container named <code>test</code>:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgc3RvcCB0ZXN0CnRlc3QKJCBkb2NrZXIgcm0gdGVzdAp0ZXN0', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker stop <span class=nb>test</span>
</span></span><span class=line><span class=cl><span class=go>test
</span></span></span><span class=line><span class=cl><span class=go></span><span class=gp>$</span> docker rm <span class=nb>test</span>
</span></span><span class=line><span class=cl><span class=go>test
</span></span></span></code></pre></div></div></div><p>If you don't specify a custom name using the <code>--name</code> flag, the daemon assigns
a randomly generated name, such as <code>vibrant_cannon</code>, to the container. Using a
custom-defined name provides the benefit of having an easy-to-remember ID for a
container.</p><p>Moreover, if you connect the container to a user-defined bridge network, other
containers on the same network can refer to the container by name via DNS.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgbmV0d29yayBjcmVhdGUgbXluZXQKY2I3OWY0NTk0OGQ4N2UzODllMTIwMTNmYTRkOTY5Njg5ZWQyYzMzMTY5ODVkZDgzMmE0M2FhZWM5YTBmZTM5NAokIGRvY2tlciBydW4gLS1uYW1lIHRlc3QgLS1uZXQgbXluZXQgLWQgbmdpbng6YWxwaW5lCjU4ZGY2ZWNmYmMyYWQ3YzQyZDA4OGVkMDI4ZDM2N2Y5ZTIyYTVmODM0ZDdjNzRjNjZjMGFiMDQ4NTYyNmMzMmEKJCBkb2NrZXIgcnVuIC0tbmV0IG15bmV0IGJ1c3lib3g6bGF0ZXN0IHBpbmcgdGVzdApQSU5HIHRlc3QgKDE3Mi4xOC4wLjIpOiA1NiBkYXRhIGJ5dGVzCjY0IGJ5dGVzIGZyb20gMTcyLjE4LjAuMjogc2VxPTAgdHRsPTY0IHRpbWU9MC4wNzMgbXMKNjQgYnl0ZXMgZnJvbSAxNzIuMTguMC4yOiBzZXE9MSB0dGw9NjQgdGltZT0wLjQxMSBtcwo2NCBieXRlcyBmcm9tIDE3Mi4xOC4wLjI6IHNlcT0yIHR0bD02NCB0aW1lPTAuMzE5IG1zCjY0IGJ5dGVzIGZyb20gMTcyLjE4LjAuMjogc2VxPTMgdHRsPTY0IHRpbWU9MC4zODMgbXMKLi4u', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker network create mynet
</span></span><span class=line><span class=cl><span class=go>cb79f45948d87e389e12013fa4d969689ed2c3316985dd832a43aaec9a0fe394
</span></span></span><span class=line><span class=cl><span class=go></span><span class=gp>$</span> docker run --name <span class=nb>test</span> --net mynet -d nginx:alpine
</span></span><span class=line><span class=cl><span class=go>58df6ecfbc2ad7c42d088ed028d367f9e22a5f834d7c74c66c0ab0485626c32a
</span></span></span><span class=line><span class=cl><span class=go></span><span class=gp>$</span> docker run --net mynet busybox:latest ping <span class=nb>test</span>
</span></span><span class=line><span class=cl><span class=go>PING test (172.18.0.2): 56 data bytes
</span></span></span><span class=line><span class=cl><span class=go>64 bytes from 172.18.0.2: seq=0 ttl=64 time=0.073 ms
</span></span></span><span class=line><span class=cl><span class=go>64 bytes from 172.18.0.2: seq=1 ttl=64 time=0.411 ms
</span></span></span><span class=line><span class=cl><span class=go>64 bytes from 172.18.0.2: seq=2 ttl=64 time=0.319 ms
</span></span></span><span class=line><span class=cl><span class=go>64 bytes from 172.18.0.2: seq=3 ttl=64 time=0.383 ms
</span></span></span><span class=line><span class=cl><span class=go>...
</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=cidfile><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#cidfile">Capture container ID (--cidfile)</a></h3><p>To help with automation, you can have Docker write the container ID out to a
file of your choosing. This is similar to how some programs might write out
their process ID to a file (you might've seen them as PID files):</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tY2lkZmlsZSAvdG1wL2RvY2tlcl90ZXN0LmNpZCB1YnVudHUgZWNobyAidGVzdCI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --cidfile /tmp/docker_test.cid ubuntu <span class=nb>echo</span> <span class=s2>&#34;test&#34;</span>
</span></span></code></pre></div></div></div><p>This creates a container and prints <code>test</code> to the console. The <code>cidfile</code>
flag makes Docker attempt to create a new file and write the container ID to it.
If the file exists already, Docker returns an error. Docker closes this
file when <code>docker run</code> exits.</p><h3 class=scroll-mt-20 id=pid><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#pid">PID settings (--pid)</a></h3><div class="group relative"><button x-data="{ code: 'LS1waWQ9IiIgIDogU2V0IHRoZSBQSUQgKFByb2Nlc3MpIE5hbWVzcGFjZSBtb2RlIGZvciB0aGUgY29udGFpbmVyLAogICAgICAgICAgICAgJ2NvbnRhaW5lcjo8bmFtZXxpZD4nOiBqb2lucyBhbm90aGVyIGNvbnRhaW5lcidzIFBJRCBuYW1lc3BhY2UKICAgICAgICAgICAgICdob3N0JzogdXNlIHRoZSBob3N0J3MgUElEIG5hbWVzcGFjZSBpbnNpZGUgdGhlIGNvbnRhaW5lcg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-text data-lang=text><span class=line><span class=cl>--pid=&#34;&#34;  : Set the PID (Process) Namespace mode for the container,
</span></span><span class=line><span class=cl>             &#39;container:&lt;name|id&gt;&#39;: joins another container&#39;s PID namespace
</span></span><span class=line><span class=cl>             &#39;host&#39;: use the host&#39;s PID namespace inside the container</span></span></code></pre></div></div></div><p>By default, all containers have the PID namespace enabled.</p><p>PID namespace provides separation of processes. The PID Namespace removes the
view of the system processes, and allows process ids to be reused including
PID 1.</p><p>In certain cases you want your container to share the host's process namespace,
allowing processes within the container to see all of the processes on the
system. For example, you could build a container with debugging tools like
<code>strace</code> or <code>gdb</code>, but want to use these tools when debugging processes within
the container.</p><h4 class=scroll-mt-20 id=example-run-htop-inside-a-container><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#example-run-htop-inside-a-container">Example: run htop inside a container</a></h4><p>To run <code>htop</code> in a container that shares the process namespace of the host:</p><ol><li><p>Run an alpine container with the <code>--pid=host</code> option:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcm0gLWl0IC0tcGlkPWhvc3QgYWxwaW5l', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --rm -it --pid<span class=o>=</span>host alpine
</span></span></code></pre></div></div></div></li><li><p>Install <code>htop</code> in the container:</p><div class="group relative"><button x-data="{ code: 'LyAjIGFwayBhZGQgaHRvcApmZXRjaCBodHRwczovL2RsLWNkbi5hbHBpbmVsaW51eC5vcmcvYWxwaW5lL3YzLjE4L21haW4vYWFyY2g2NC9BUEtJTkRFWC50YXIuZ3oKZmV0Y2ggaHR0cHM6Ly9kbC1jZG4uYWxwaW5lbGludXgub3JnL2FscGluZS92My4xOC9jb21tdW5pdHkvYWFyY2g2NC9BUEtJTkRFWC50YXIuZ3oKKDEvMykgSW5zdGFsbGluZyBuY3Vyc2VzLXRlcm1pbmZvLWJhc2UgKDYuNF9wMjAyMzA1MDYtcjApCigyLzMpIEluc3RhbGxpbmcgbGlibmN1cnNlc3cgKDYuNF9wMjAyMzA1MDYtcjApCigzLzMpIEluc3RhbGxpbmcgaHRvcCAoMy4yLjItcjEpCkV4ZWN1dGluZyBidXN5Ym94LTEuMzYuMS1yMi50cmlnZ2VyCk9LOiA5IE1pQiBpbiAxOCBwYWNrYWdlcw==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>/ # apk add htop
</span></span></span><span class=line><span class=cl><span class=go>fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/aarch64/APKINDEX.tar.gz
</span></span></span><span class=line><span class=cl><span class=go>fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/aarch64/APKINDEX.tar.gz
</span></span></span><span class=line><span class=cl><span class=go>(1/3) Installing ncurses-terminfo-base (6.4_p20230506-r0)
</span></span></span><span class=line><span class=cl><span class=go>(2/3) Installing libncursesw (6.4_p20230506-r0)
</span></span></span><span class=line><span class=cl><span class=go>(3/3) Installing htop (3.2.2-r1)
</span></span></span><span class=line><span class=cl><span class=go>Executing busybox-1.36.1-r2.trigger
</span></span></span><span class=line><span class=cl><span class=go>OK: 9 MiB in 18 packages
</span></span></span></code></pre></div></div></div></li><li><p>Invoke the <code>htop</code> command.</p><div class="group relative"><button x-data="{ code: 'LyAjIGh0b3A=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>/ # htop
</span></span></span></code></pre></div></div></div></li></ol><h4 class=scroll-mt-20 id=example-join-another-containers-pid-namespace><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#example-join-another-containers-pid-namespace">Example, join another container's PID namespace</a></h4><p>Joining another container's PID namespace can be useful for debugging that
container.</p><ol><li><p>Start a container running a Redis server:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcm0gLS1uYW1lIG15LW5naW54IC1kIG5naW54OmFscGluZQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --rm --name my-nginx -d nginx:alpine
</span></span></code></pre></div></div></div></li><li><p>Run an Alpine container that attaches the <code>--pid</code> namespace to the
<code>my-nginx</code> container:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcm0gLWl0IC0tcGlkPWNvbnRhaW5lcjpteS1uZ2lueCBcCiAgLS1jYXAtYWRkIFNZU19QVFJBQ0UgXAogIC0tc2VjdXJpdHktb3B0IHNlY2NvbXA9dW5jb25maW5lZCBcCiAgYWxwaW5l', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --rm -it --pid<span class=o>=</span>container:my-nginx <span class=se>\
</span></span></span><span class=line><span class=cl><span class=se></span><span class=go>  --cap-add SYS_PTRACE \
</span></span></span><span class=line><span class=cl><span class=go>  --security-opt seccomp=unconfined \
</span></span></span><span class=line><span class=cl><span class=go>  alpine
</span></span></span></code></pre></div></div></div></li><li><p>Install <code>strace</code> in the Alpine container:</p><div class="group relative"><button x-data="{ code: 'LyAjIGFwayBhZGQgc3RyYWNl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>/ # apk add strace
</span></span></span></code></pre></div></div></div></li><li><p>Attach to process 1, the process ID of the <code>my-nginx</code> container:</p><div class="group relative"><button x-data="{ code: 'LyAjIHN0cmFjZSAtcCAxCnN0cmFjZTogUHJvY2VzcyAxIGF0dGFjaGVk', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>/ # strace -p 1
</span></span></span><span class=line><span class=cl><span class=go>strace: Process 1 attached
</span></span></span></code></pre></div></div></div></li></ol><h3 class=scroll-mt-20 id=uts><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#uts">UTS settings (--uts)</a></h3><div class="group relative"><button x-data="{ code: 'LS11dHM9IiIgIDogU2V0IHRoZSBVVFMgbmFtZXNwYWNlIG1vZGUgZm9yIHRoZSBjb250YWluZXIKICAgICAgICAgICAgJ2hvc3QnOiB1c2UgdGhlIGhvc3QncyBVVFMgbmFtZXNwYWNlIGluc2lkZSB0aGUgY29udGFpbmVy', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-text data-lang=text><span class=line><span class=cl>--uts=&#34;&#34;  : Set the UTS namespace mode for the container
</span></span><span class=line><span class=cl>            &#39;host&#39;: use the host&#39;s UTS namespace inside the container</span></span></code></pre></div></div></div><p>The UTS namespace is for setting the hostname and the domain that's visible to
running processes in that namespace. By default, all containers, including
those with <code>--network=host</code>, have their own UTS namespace. Setting <code>--uts</code> to
<code>host</code> results in the container using the same UTS namespace as the host.</p><blockquote><p><strong>Note</strong></p><p>Docker disallows combining the <code>--hostname</code> and <code>--domainname</code> flags with
<code>--uts=host</code>. This is to prevent containers running in the host's UTS
namespace from attempting to change the hosts' configuration.</p></blockquote><p>You may wish to share the UTS namespace with the host if you would like the
hostname of the container to change as the hostname of the host changes. A more
advanced use case would be changing the host's hostname from a container.</p><h3 class=scroll-mt-20 id=ipc><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#ipc">IPC settings (--ipc)</a></h3><div class="group relative"><button x-data="{ code: 'LS1pcGM9Ik1PREUiICA6IFNldCB0aGUgSVBDIG1vZGUgZm9yIHRoZSBjb250YWluZXI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-text data-lang=text><span class=line><span class=cl>--ipc=&#34;MODE&#34;  : Set the IPC mode for the container</span></span></code></pre></div></div></div><p>The <code>--ipc</code> flag accepts the following values:</p><table><thead><tr><th style=text-align:left>Value</th><th style=text-align:left>Description</th></tr></thead><tbody><tr><td style=text-align:left>""</td><td style=text-align:left>Use daemon's default.</td></tr><tr><td style=text-align:left>"none"</td><td style=text-align:left>Own private IPC namespace, with /dev/shm not mounted.</td></tr><tr><td style=text-align:left>"private"</td><td style=text-align:left>Own private IPC namespace.</td></tr><tr><td style=text-align:left>"shareable"</td><td style=text-align:left>Own private IPC namespace, with a possibility to share it with other containers.</td></tr><tr><td style=text-align:left>"container:&lt;<em>name-or-ID</em>>"</td><td style=text-align:left>Join another ("shareable") container's IPC namespace.</td></tr><tr><td style=text-align:left>"host"</td><td style=text-align:left>Use the host system's IPC namespace.</td></tr></tbody></table><p>If not specified, daemon default is used, which can either be <code>"private"</code>
or <code>"shareable"</code>, depending on the daemon version and configuration.</p><p><a class=link href=https://linux.die.net/man/5/ipc target=_blank rel=noopener>System V interprocess communication (IPC)<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
namespaces provide separation of named shared memory segments, semaphores and
message queues.</p><p>Shared memory segments are used to accelerate inter-process communication at
memory speed, rather than through pipes or through the network stack. Shared
memory is commonly used by databases and custom-built (typically C/OpenMPI,
C++/using boost libraries) high performance applications for scientific
computing and financial services industries. If these types of applications
are broken into multiple containers, you might need to share the IPC mechanisms
of the containers, using <code>"shareable"</code> mode for the main (i.e. "donor")
container, and <code>"container:&lt;donor-name-or-ID>"</code> for other containers.</p><h3 class=scroll-mt-20 id=privileged><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#privileged">Full container capabilities (--privileged)</a></h3><p>The following example doesn't work, because by default, Docker drops most
potentially dangerous kernel capabilities, including <code>CAP_SYS_ADMIN </code>(which is
required to mount filesystems).</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC10IC1pIC0tcm0gdWJ1bnR1IGJhc2gKcm9vdEBiYzMzODk0MmVmMjA6LyMgbW91bnQgLXQgdG1wZnMgbm9uZSAvbW50Cm1vdW50OiBwZXJtaXNzaW9uIGRlbmllZA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -t -i --rm ubuntu bash
</span></span><span class=line><span class=cl><span class=go>root@bc338942ef20:/# mount -t tmpfs none /mnt
</span></span></span><span class=line><span class=cl><span class=go>mount: permission denied
</span></span></span></code></pre></div></div></div><p>It works when you add the <code>--privileged</code> flag:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC10IC1pIC0tcHJpdmlsZWdlZCB1YnVudHUgYmFzaApyb290QDUwZTNmNTdlMTZlNjovIyBtb3VudCAtdCB0bXBmcyBub25lIC9tbnQKcm9vdEA1MGUzZjU3ZTE2ZTY6LyMgZGYgLWgKRmlsZXN5c3RlbSAgICAgIFNpemUgIFVzZWQgQXZhaWwgVXNlJSBNb3VudGVkIG9uCm5vbmUgICAgICAgICAgICAxLjlHICAgICAwICAxLjlHICAgMCUgL21udA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -t -i --privileged ubuntu bash
</span></span><span class=line><span class=cl><span class=go>root@50e3f57e16e6:/# mount -t tmpfs none /mnt
</span></span></span><span class=line><span class=cl><span class=go>root@50e3f57e16e6:/# df -h
</span></span></span><span class=line><span class=cl><span class=go>Filesystem      Size  Used Avail Use% Mounted on
</span></span></span><span class=line><span class=cl><span class=go>none            1.9G     0  1.9G   0% /mnt
</span></span></span></code></pre></div></div></div><p>The <code>--privileged</code> flag gives all capabilities to the container, and it also
lifts all the limitations enforced by the <code>device</code> cgroup controller. In other
words, the container can then do almost everything that the host can do. This
flag exists to allow special use-cases, like running Docker within Docker.</p><h3 class=scroll-mt-20 id=workdir><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#workdir">Set working directory (-w, --workdir)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC13IC9wYXRoL3RvL2Rpci8gLWkgLXQgdWJ1bnR1IHB3ZA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -w /path/to/dir/ -i -t ubuntu <span class=nb>pwd</span>
</span></span></code></pre></div></div></div><p>The <code>-w</code> option runs the command executed inside the directory specified, in this example,
<code>/path/to/dir/</code>. If the path doesn't exist, Docker creates it inside the container.</p><h3 class=scroll-mt-20 id=storage-opt><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#storage-opt">Set storage driver options per container (--storage-opt)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pdCAtLXN0b3JhZ2Utb3B0IHNpemU9MTIwRyBmZWRvcmEgL2Jpbi9iYXNo', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -it --storage-opt <span class=nv>size</span><span class=o>=</span>120G fedora /bin/bash
</span></span></code></pre></div></div></div><p>This (size) constraints the container filesystem size to 120G at creation time.
This option is only available for the <code>btrfs</code>, <code>overlay2</code>, <code>windowsfilter</code>,
and <code>zfs</code> storage drivers.</p><p>For the <code>overlay2</code> storage driver, the size option is only available if the
backing filesystem is <code>xfs</code> and mounted with the <code>pquota</code> mount option.
Under these conditions, you can pass any size less than the backing filesystem size.</p><p>For the <code>windowsfilter</code>, <code>btrfs</code>, and <code>zfs</code> storage drivers, you cannot pass a
size less than the Default BaseFS Size.</p><h3 class=scroll-mt-20 id=tmpfs><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#tmpfs">Mount tmpfs (--tmpfs)</a></h3><p>The <code>--tmpfs</code> flag lets you create a <code>tmpfs</code> mount.</p><p>The options that you can pass to <code>--tmpfs</code> are identical to the Linux <code>mount -t tmpfs -o</code> command. The following example mounts an empty <code>tmpfs</code> into the
container with the <code>rw</code>, <code>noexec</code>, <code>nosuid</code>, <code>size=65536k</code> options.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1kIC0tdG1wZnMgL3J1bjpydyxub2V4ZWMsbm9zdWlkLHNpemU9NjU1MzZrIG15X2ltYWdl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -d --tmpfs /run:rw,noexec,nosuid,size<span class=o>=</span>65536k my_image
</span></span></code></pre></div></div></div><p>For more information, see
<a class=link href="../../../../../storage/tmpfs/index.html">tmpfs mounts</a>.</p><h3 class=scroll-mt-20 id=volume><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#volume">Mount volume (-v)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgIHJ1biAgLXYgJChwd2QpOiQocHdkKSAtdyAkKHB3ZCkgLWkgLXQgIHVidW50dSBwd2Q=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker  run  -v <span class=k>$(</span><span class=nb>pwd</span><span class=k>)</span>:<span class=k>$(</span><span class=nb>pwd</span><span class=k>)</span> -w <span class=k>$(</span><span class=nb>pwd</span><span class=k>)</span> -i -t  ubuntu <span class=nb>pwd</span>
</span></span></code></pre></div></div></div><p>The example above mounts the current directory into the container at the same path
using the <code>-v</code> flag, sets it as the working directory, and then runs the <code>pwd</code> command inside the container.</p><p>As of Docker Engine version 23, you can use relative paths on the host.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgIHJ1biAgLXYgLi9jb250ZW50Oi9jb250ZW50IC13IC9jb250ZW50IC1pIC10ICB1YnVudHUgcHdk', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker  run  -v ./content:/content -w /content -i -t  ubuntu <span class=nb>pwd</span>
</span></span></code></pre></div></div></div><p>The example above mounts the <code>content</code> directory in the current directory into the container at the
<code>/content</code> path using the <code>-v</code> flag, sets it as the working directory, and then
runs the <code>pwd</code> command inside the container.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC12IC9kb2VzbnQvZXhpc3Q6L2ZvbyAtdyAvZm9vIC1pIC10IHVidW50dSBiYXNo', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash
</span></span></code></pre></div></div></div><p>When the host directory of a bind-mounted volume doesn't exist, Docker
automatically creates this directory on the host for you. In the
example above, Docker creates the <code>/doesnt/exist</code>
folder before starting your container.</p><h3 class=scroll-mt-20 id=read-only><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#read-only">Mount volume read-only (--read-only)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcmVhZC1vbmx5IC12IC9pY2Fud3JpdGUgYnVzeWJveCB0b3VjaCAvaWNhbndyaXRlL2hlcmU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --read-only -v /icanwrite busybox touch /icanwrite/here
</span></span></code></pre></div></div></div><p>You can use volumes in combination with the <code>--read-only</code> flag to control where
a container writes files. The <code>--read-only</code> flag mounts the container's root
filesystem as read only prohibiting writes to locations other than the
specified volumes for the container.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC10IC1pIC12IC92YXIvcnVuL2RvY2tlci5zb2NrOi92YXIvcnVuL2RvY2tlci5zb2NrIC12IC9wYXRoL3RvL3N0YXRpYy1kb2NrZXItYmluYXJ5Oi91c3IvYmluL2RvY2tlciBidXN5Ym94IHNo', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -t -i -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/static-docker-binary:/usr/bin/docker busybox sh
</span></span></code></pre></div></div></div><p>By bind-mounting the Docker Unix socket and statically linked Docker
binary (refer to
<a class=link href="../../../../../engine/install/binaries/index.html#install-static-binaries">get the Linux binary</a>),
you give the container the full access to create and manipulate the host's
Docker daemon.</p><p>On Windows, you must specify the paths using Windows-style path semantics.</p><div class="group relative"><button x-data="{ code: 'UFMgQzpcPiBkb2NrZXIgcnVuIC12IGM6XGZvbzpjOlxkZXN0IG1pY3Jvc29mdC9uYW5vc2VydmVyIGNtZCAvcyAvYyB0eXBlIGM6XGRlc3Rcc29tZWZpbGUudHh0CkNvbnRlbnRzIG9mIGZpbGUKClBTIEM6XD4gZG9ja2VyIHJ1biAtdiBjOlxmb286ZDogbWljcm9zb2Z0L25hbm9zZXJ2ZXIgY21kIC9zIC9jIHR5cGUgZDpcc29tZWZpbGUudHh0CkNvbnRlbnRzIG9mIGZpbGU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-powershell data-lang=powershell><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-v</span> <span class=n>c:</span><span class=p>\</span><span class=n>foo</span><span class=err>:</span><span class=n>c:</span><span class=p>\</span><span class=n>dest</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>cmd</span> <span class=p>/</span><span class=n>s</span> <span class=p>/</span><span class=n>c</span> <span class=nb>type </span><span class=n>c:</span><span class=p>\</span><span class=n>dest</span><span class=p>\</span><span class=n>somefile</span><span class=p>.</span><span class=py>txt</span>
</span></span><span class=line><span class=cl><span class=n>Contents</span> <span class=n>of</span> <span class=n>file</span>
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-v</span> <span class=n>c:</span><span class=p>\</span><span class=n>foo</span><span class=err>:</span><span class=n>d:</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>cmd</span> <span class=p>/</span><span class=n>s</span> <span class=p>/</span><span class=n>c</span> <span class=nb>type </span><span class=n>d:</span><span class=p>\</span><span class=n>somefile</span><span class=p>.</span><span class=py>txt</span>
</span></span><span class=line><span class=cl><span class=n>Contents</span> <span class=n>of</span> <span class=n>file</span></span></span></code></pre></div></div></div><p>The following examples fails when using Windows-based containers, as the
destination of a volume or bind mount inside the container must be one of:
a non-existing or empty directory; or a drive other than <code>C:</code>. Further, the source
of a bind mount must be a local directory, not a file.</p><div class="group relative"><button x-data="{ code: 'bmV0IHVzZSB6OiBcXHJlbW90ZW1hY2hpbmVcc2hhcmUKZG9ja2VyIHJ1biAtdiB6Olxmb286YzpcZGVzdCAuLi4KZG9ja2VyIHJ1biAtdiBcXHVuY3BhdGhcdG9cZGlyZWN0b3J5OmM6XGRlc3QgLi4uCmRvY2tlciBydW4gLXYgYzpcZm9vXHNvbWVmaWxlLnR4dDpjOlxkZXN0IC4uLgpkb2NrZXIgcnVuIC12IGM6XGZvbzpjOiAuLi4KZG9ja2VyIHJ1biAtdiBjOlxmb286YzpcZXhpc3RpbmctZGlyZWN0b3J5LXdpdGgtY29udGVudHMgLi4u', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-powershell data-lang=powershell><span class=line><span class=cl><span class=n>net</span> <span class=n>use</span> <span class=n>z:</span> <span class=p>\\</span><span class=n>remotemachine</span><span class=p>\</span><span class=n>share</span>
</span></span><span class=line><span class=cl><span class=n>docker</span> <span class=n>run</span> <span class=n>-v</span> <span class=n>z:</span><span class=p>\</span><span class=n>foo</span><span class=err>:</span><span class=n>c:</span><span class=p>\</span><span class=n>dest</span> <span class=p>...</span>
</span></span><span class=line><span class=cl><span class=n>docker</span> <span class=n>run</span> <span class=n>-v</span> <span class=p>\\</span><span class=n>uncpath</span><span class=p>\</span><span class=n>to</span><span class=p>\</span><span class=n>directory</span><span class=err>:</span><span class=n>c:</span><span class=p>\</span><span class=n>dest</span> <span class=p>...</span>
</span></span><span class=line><span class=cl><span class=n>docker</span> <span class=n>run</span> <span class=n>-v</span> <span class=n>c:</span><span class=p>\</span><span class=n>foo</span><span class=p>\</span><span class=n>somefile</span><span class=p>.</span><span class=n>txt</span><span class=err>:</span><span class=n>c:</span><span class=p>\</span><span class=n>dest</span> <span class=p>...</span>
</span></span><span class=line><span class=cl><span class=n>docker</span> <span class=n>run</span> <span class=n>-v</span> <span class=n>c:</span><span class=p>\</span><span class=n>foo</span><span class=err>:</span><span class=n>c:</span> <span class=p>...</span>
</span></span><span class=line><span class=cl><span class=n>docker</span> <span class=n>run</span> <span class=n>-v</span> <span class=n>c:</span><span class=p>\</span><span class=n>foo</span><span class=err>:</span><span class=n>c:</span><span class=p>\</span><span class=nb>existing-directory</span><span class=n>-with-contents</span> <span class=p>...</span></span></span></code></pre></div></div></div><p>For in-depth information about volumes, refer to
<a class=link href="../../../../../storage/volumes/index.html">manage data in containers</a></p><h3 class=scroll-mt-20 id=mount><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#mount">Add bind mounts or volumes using the --mount flag</a></h3><p>The <code>--mount</code> flag allows you to mount volumes, host-directories, and <code>tmpfs</code>
mounts in a container.</p><p>The <code>--mount</code> flag supports most options supported by the <code>-v</code> or the
<code>--volume</code> flag, but uses a different syntax. For in-depth information on the
<code>--mount</code> flag, and a comparison between <code>--volume</code> and <code>--mount</code>, refer to
<a class=link href="../../../../../storage/bind-mounts/index.html">Bind mounts</a>.</p><p>Even though there is no plan to deprecate <code>--volume</code>, usage of <code>--mount</code> is recommended.</p><p>Examples:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcmVhZC1vbmx5IC0tbW91bnQgdHlwZT12b2x1bWUsdGFyZ2V0PS9pY2Fud3JpdGUgYnVzeWJveCB0b3VjaCAvaWNhbndyaXRlL2hlcmU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --read-only --mount <span class=nv>type</span><span class=o>=</span>volume,target<span class=o>=</span>/icanwrite busybox touch /icanwrite/here
</span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC10IC1pIC0tbW91bnQgdHlwZT1iaW5kLHNyYz0vZGF0YSxkc3Q9L2RhdGEgYnVzeWJveCBzaA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -t -i --mount <span class=nv>type</span><span class=o>=</span>bind,src<span class=o>=</span>/data,dst<span class=o>=</span>/data busybox sh
</span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=publish><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#publish">Publish or expose port (-p, --expose)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1wIDEyNy4wLjAuMTo4MDo4MDgwL3RjcCBuZ2lueDphbHBpbmU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -p 127.0.0.1:80:8080/tcp nginx:alpine
</span></span></code></pre></div></div></div><p>This binds port <code>8080</code> of the container to TCP port <code>80</code> on <code>127.0.0.1</code> of the
host. You can also specify <code>udp</code> and <code>sctp</code> ports. The
<a class=link href="../../../../../engine/userguide/networking/index.html">Networking overview
page</a> explains in detail how to publish ports
with Docker.</p><blockquote><p><strong>Note</strong></p><p>If you don't specify an IP address (i.e., <code>-p 80:80</code> instead of <code>-p 127.0.0.1:80:80</code>) when publishing a container's ports, Docker publishes the
port on all interfaces (address <code>0.0.0.0</code>) by default. These ports are
externally accessible. This also applies if you configured UFW to block this
specific port, as Docker manages its own iptables rules.
<a class=link href="../../../../../network/packet-filtering-firewalls/index.html">Read
more</a></p></blockquote><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tZXhwb3NlIDgwIG5naW54OmFscGluZQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --expose <span class=m>80</span> nginx:alpine
</span></span></code></pre></div></div></div><p>This exposes port <code>80</code> of the container without publishing the port to the host
system's interfaces.</p><h3 class=scroll-mt-20 id=publish-all><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#publish-all">Publish all exposed ports (-P, --publish-all)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1QIG5naW54OmFscGluZQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -P nginx:alpine
</span></span></code></pre></div></div></div><p>The <code>-P</code>, or <code>--publish-all</code>, flag publishes all the exposed ports to the host.
Docker binds each exposed port to a random port on the host.</p><p>The <code>-P</code> flag only publishes port numbers that are explicitly flagged as
exposed, either using the Dockerfile <code>EXPOSE</code> instruction or the <code>--expose</code>
flag for the <code>docker run</code> command.</p><p>The range of ports are within an <em>ephemeral port range</em> defined by
<code>/proc/sys/net/ipv4/ip_local_port_range</code>. Use the <code>-p</code> flag to explicitly map a
single port or range of ports.</p><h3 class=scroll-mt-20 id=pull><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#pull">Set the pull policy (--pull)</a></h3><p>Use the <code>--pull</code> flag to set the image pull policy when creating (and running)
the container.</p><p>The <code>--pull</code> flag can take one of these values:</p><table><thead><tr><th style=text-align:left>Value</th><th style=text-align:left>Description</th></tr></thead><tbody><tr><td style=text-align:left><code>missing</code> (default)</td><td style=text-align:left>Pull the image if it was not found in the image cache, or use the cached image otherwise.</td></tr><tr><td style=text-align:left><code>never</code></td><td style=text-align:left>Do not pull the image, even if it's missing, and produce an error if the image does not exist in the image cache.</td></tr><tr><td style=text-align:left><code>always</code></td><td style=text-align:left>Always perform a pull before creating the container.</td></tr></tbody></table><p>When creating (and running) a container from an image, the daemon checks if the
image exists in the local image cache. If the image is missing, an error is
returned to the CLI, allowing it to initiate a pull.</p><p>The default (<code>missing</code>) is to only pull the image if it's not present in the
daemon's image cache. This default allows you to run images that only exist
locally (for example, images you built from a Dockerfile, but that have not
been pushed to a registry), and reduces networking.</p><p>The <code>always</code> option always initiates a pull before creating the container. This
option makes sure the image is up-to-date, and prevents you from using outdated
images, but may not be suitable in situations where you want to test a locally
built image before pushing (as pulling the image overwrites the existing image
in the image cache).</p><p>The <code>never</code> option disables (implicit) pulling images when creating containers,
and only uses images that are available in the image cache. If the specified
image is not found, an error is produced, and the container is not created.
This option is useful in situations where networking is not available, or to
prevent images from being pulled implicitly when creating containers.</p><p>The following example shows <code>docker run</code> with the <code>--pull=never</code> option set,
which produces en error as the image is missing in the image-cache:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcHVsbD1uZXZlciBoZWxsby13b3JsZApkb2NrZXI6IEVycm9yIHJlc3BvbnNlIGZyb20gZGFlbW9uOiBObyBzdWNoIGltYWdlOiBoZWxsby13b3JsZDpsYXRlc3Qu', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --pull<span class=o>=</span>never hello-world
</span></span><span class=line><span class=cl><span class=go>docker: Error response from daemon: No such image: hello-world:latest.
</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=env><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#env">Set environment variables (-e, --env, --env-file)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1lIE1ZVkFSMSAtLWVudiBNWVZBUjI9Zm9vIC0tZW52LWZpbGUgLi9lbnYubGlzdCB1YnVudHUgYmFzaA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -e MYVAR1 --env <span class=nv>MYVAR2</span><span class=o>=</span>foo --env-file ./env.list ubuntu bash
</span></span></code></pre></div></div></div><p>Use the <code>-e</code>, <code>--env</code>, and <code>--env-file</code> flags to set simple (non-array)
environment variables in the container you're running, or overwrite variables
defined in the Dockerfile of the image you're running.</p><p>You can define the variable and its value when running the container:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tZW52IFZBUjE9dmFsdWUxIC0tZW52IFZBUjI9dmFsdWUyIHVidW50dSBlbnYgfCBncmVwIFZBUgpWQVIxPXZhbHVlMQpWQVIyPXZhbHVlMg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --env <span class=nv>VAR1</span><span class=o>=</span>value1 --env <span class=nv>VAR2</span><span class=o>=</span>value2 ubuntu env <span class=p>|</span> grep VAR
</span></span><span class=line><span class=cl><span class=go>VAR1=value1
</span></span></span><span class=line><span class=cl><span class=go>VAR2=value2
</span></span></span></code></pre></div></div></div><p>You can also use variables exported to your local environment:</p><div class="group relative"><button x-data="{ code: 'ZXhwb3J0IFZBUjE9dmFsdWUxCmV4cG9ydCBWQVIyPXZhbHVlMgoKJCBkb2NrZXIgcnVuIC0tZW52IFZBUjEgLS1lbnYgVkFSMiB1YnVudHUgZW52IHwgZ3JlcCBWQVIKVkFSMT12YWx1ZTEKVkFSMj12YWx1ZTI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>export VAR1=value1
</span></span></span><span class=line><span class=cl><span class=go>export VAR2=value2
</span></span></span><span class=line><span class=cl><span class=go></span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>$</span> docker run --env VAR1 --env VAR2 ubuntu env <span class=p>|</span> grep VAR
</span></span><span class=line><span class=cl><span class=go>VAR1=value1
</span></span></span><span class=line><span class=cl><span class=go>VAR2=value2
</span></span></span></code></pre></div></div></div><p>When running the command, the Docker CLI client checks the value the variable
has in your local environment and passes it to the container.
If no <code>=</code> is provided and that variable isn't exported in your local
environment, the variable is unset in the container.</p><p>You can also load the environment variables from a file. This file should use
the syntax <code>&lt;variable>=value</code> (which sets the variable to the given value) or
<code>&lt;variable></code> (which takes the value from the local environment), and <code>#</code> for
comments. Lines beginning with <code>#</code> are treated as line comments and are
ignored, whereas a <code>#</code> appearing anywhere else in a line is treated as part of
the variable value.</p><div class="group relative"><button x-data="{ code: 'JCBjYXQgZW52Lmxpc3QKIyBUaGlzIGlzIGEgY29tbWVudApWQVIxPXZhbHVlMQpWQVIyPXZhbHVlMgpVU0VSCgokIGRvY2tlciBydW4gLS1lbnYtZmlsZSBlbnYubGlzdCB1YnVudHUgZW52IHwgZ3JlcCAtRSAnVkFSfFVTRVInClZBUjE9dmFsdWUxClZBUjI9dmFsdWUyClVTRVI9am9uemVvbGxh', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> cat env.list
</span></span><span class=line><span class=cl><span class=gp>#</span> This is a comment
</span></span><span class=line><span class=cl><span class=go>VAR1=value1
</span></span></span><span class=line><span class=cl><span class=go>VAR2=value2
</span></span></span><span class=line><span class=cl><span class=go>USER
</span></span></span><span class=line><span class=cl><span class=go></span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>$</span> docker run --env-file env.list ubuntu env <span class=p>|</span> grep -E <span class=s1>&#39;VAR|USER&#39;</span>
</span></span><span class=line><span class=cl><span class=go>VAR1=value1
</span></span></span><span class=line><span class=cl><span class=go>VAR2=value2
</span></span></span><span class=line><span class=cl><span class=go>USER=jonzeolla
</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=label><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#label">Set metadata on container (-l, --label, --label-file)</a></h3><p>A label is a <code>key=value</code> pair that applies metadata to a container. To label a container with two labels:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1sIG15LWxhYmVsIC0tbGFiZWwgY29tLmV4YW1wbGUuZm9vPWJhciB1YnVudHUgYmFzaA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -l my-label --label com.example.foo<span class=o>=</span>bar ubuntu bash
</span></span></code></pre></div></div></div><p>The <code>my-label</code> key doesn't specify a value so the label defaults to an empty
string (<code>""</code>). To add multiple labels, repeat the label flag (<code>-l</code> or <code>--label</code>).</p><p>The <code>key=value</code> must be unique to avoid overwriting the label value. If you
specify labels with identical keys but different values, each subsequent value
overwrites the previous. Docker uses the last <code>key=value</code> you supply.</p><p>Use the <code>--label-file</code> flag to load multiple labels from a file. Delimit each
label in the file with an EOL mark. The example below loads labels from a
labels file in the current directory:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tbGFiZWwtZmlsZSAuL2xhYmVscyB1YnVudHUgYmFzaA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --label-file ./labels ubuntu bash
</span></span></code></pre></div></div></div><p>The label-file format is similar to the format for loading environment
variables. (Unlike environment variables, labels are not visible to processes
running inside a container.) The following example shows a label-file
format:</p><div class="group relative"><button x-data="{ code: 'Y29tLmV4YW1wbGUubGFiZWwxPSJhIGxhYmVsIgoKIyB0aGlzIGlzIGEgY29tbWVudApjb20uZXhhbXBsZS5sYWJlbDI9YW5vdGhlclwgbGFiZWwKY29tLmV4YW1wbGUubGFiZWwz', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>com.example.label1=&#34;a label&#34;
</span></span></span><span class=line><span class=cl><span class=go></span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>#</span> this is a comment
</span></span><span class=line><span class=cl><span class=go>com.example.label2=another\ label
</span></span></span><span class=line><span class=cl><span class=go>com.example.label3
</span></span></span></code></pre></div></div></div><p>You can load multiple label-files by supplying multiple <code>--label-file</code> flags.</p><p>For additional information on working with labels, see
<a class=link href="../../../../../engine/userguide/labels-custom-metadata/index.html">Labels</a>.</p><h3 class=scroll-mt-20 id=network><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#network">Connect a container to a network (--network)</a></h3><p>To start a container and connect it to a network, use the <code>--network</code> option.</p><p>The following commands create a network named <code>my-net</code> and adds a <code>busybox</code> container
to the <code>my-net</code> network.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgbmV0d29yayBjcmVhdGUgbXktbmV0CiQgZG9ja2VyIHJ1biAtaXRkIC0tbmV0d29yaz1teS1uZXQgYnVzeWJveA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker network create my-net
</span></span><span class=line><span class=cl><span class=gp>$</span> docker run -itd --network<span class=o>=</span>my-net busybox
</span></span></code></pre></div></div></div><p>You can also choose the IP addresses for the container with <code>--ip</code> and <code>--ip6</code>
flags when you start the container on a user-defined network. To assign a
static IP to containers, you must specify subnet block for the network.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgbmV0d29yayBjcmVhdGUgLS1zdWJuZXQgMTkyLjAuMi4wLzI0IG15LW5ldAokIGRvY2tlciBydW4gLWl0ZCAtLW5ldHdvcms9bXktbmV0IC0taXA9MTkyLjAuMi42OSBidXN5Ym94', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker network create --subnet 192.0.2.0/24 my-net
</span></span><span class=line><span class=cl><span class=gp>$</span> docker run -itd --network<span class=o>=</span>my-net --ip<span class=o>=</span>192.0.2.69 busybox
</span></span></code></pre></div></div></div><p>If you want to add a running container to a network use the <code>docker network connect</code> subcommand.</p><p>You can connect multiple containers to the same network. Once connected, the
containers can communicate using only another container's IP address
or name. For <code>overlay</code> networks or custom plugins that support multi-host
connectivity, containers connected to the same multi-host network but launched
from different Engines can also communicate in this way.</p><blockquote><p><strong>Note</strong></p><p>The default bridge network only allow containers to communicate with each other using
internal IP addresses. User-created bridge networks provide DNS resolution between
containers using container names.</p></blockquote><p>You can disconnect a container from a network using the <code>docker network disconnect</code> command.</p><p>For more information on connecting a container to a network when using the <code>run</code> command, see the
<a class=link href="../../../../../engine/userguide/networking/index.html">"<em>Docker network overview</em>"</a>.</p><h3 class=scroll-mt-20 id=volumes-from><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#volumes-from">Mount volumes from container (--volumes-from)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tdm9sdW1lcy1mcm9tIDc3N2Y3ZGM5MmRhNyAtLXZvbHVtZXMtZnJvbSBiYThjMGM1NGYwZjI6cm8gLWkgLXQgdWJ1bnR1IHB3ZA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --volumes-from 777f7dc92da7 --volumes-from ba8c0c54f0f2:ro -i -t ubuntu <span class=nb>pwd</span>
</span></span></code></pre></div></div></div><p>The <code>--volumes-from</code> flag mounts all the defined volumes from the referenced
containers. You can specify more than one container by repetitions of the <code>--volumes-from</code>
argument. The container ID may be optionally suffixed with <code>:ro</code> or <code>:rw</code> to
mount the volumes in read-only or read-write mode, respectively. By default,
Docker mounts the volumes in the same mode (read write or read only) as
the reference container.</p><p>Labeling systems like SELinux require placing proper labels on volume
content mounted into a container. Without a label, the security system might
prevent the processes running inside the container from using the content. By
default, Docker does not change the labels set by the OS.</p><p>To change the label in the container context, you can add either of two suffixes
<code>:z</code> or <code>:Z</code> to the volume mount. These suffixes tell Docker to relabel file
objects on the shared volumes. The <code>z</code> option tells Docker that two containers
share the volume content. As a result, Docker labels the content with a shared
content label. Shared volume labels allow all containers to read/write content.
The <code>Z</code> option tells Docker to label the content with a private unshared label.
Only the current container can use a private volume.</p><h3 class=scroll-mt-20 id=detach><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#detach">Detached mode (-d, --detach)</a></h3><p>The <code>--detach</code> (or <code>-d</code>) flag starts a container as a background process that
doesn't occupy your terminal window. By design, containers started in detached
mode exit when the root process used to run the container exits, unless you
also specify the <code>--rm</code> option. If you use <code>-d</code> with <code>--rm</code>, the container is
removed when it exits or when the daemon exits, whichever happens first.</p><p>Don't pass a <code>service x start</code> command to a detached container. For example,
this command attempts to start the <code>nginx</code> service.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1kIC1wIDgwOjgwIG15X2ltYWdlIHNlcnZpY2Ugbmdpbnggc3RhcnQ=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -d -p 80:80 my_image service nginx start
</span></span></code></pre></div></div></div><p>This succeeds in starting the <code>nginx</code> service inside the container. However, it
fails the detached container paradigm in that, the root process (<code>service nginx start</code>) returns and the detached container stops as designed. As a result, the
<code>nginx</code> service starts but can't be used. Instead, to start a process such as
the <code>nginx</code> web server do the following:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1kIC1wIDgwOjgwIG15X2ltYWdlIG5naW54IC1nICdkYWVtb24gb2ZmOyc=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -d -p 80:80 my_image nginx -g <span class=s1>&#39;daemon off;&#39;</span>
</span></span></code></pre></div></div></div><p>To do input/output with a detached container use network connections or shared
volumes. These are required because the container is no longer listening to the
command line where <code>docker run</code> was run.</p><h3 class=scroll-mt-20 id=detach-keys><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#detach-keys">Override the detach sequence (--detach-keys)</a></h3><p>Use the <code>--detach-keys</code> option to override the Docker key sequence for detach.
This is useful if the Docker default sequence conflicts with key sequence you
use for other applications. There are two ways to define your own detach key
sequence, as a per-container override or as a configuration property on your
entire configuration.</p><p>To override the sequence for an individual container, use the
<code>--detach-keys="&lt;sequence>"</code> flag with the <code>docker attach</code> command. The format of
the <code>&lt;sequence></code> is either a letter [a-Z], or the <code>ctrl-</code> combined with any of
the following:</p><ul><li><code>a-z</code> (a single lowercase alpha character )</li><li><code>@</code> (at sign)</li><li><code>[</code> (left bracket)</li><li><code>\\</code> (two backward slashes)</li><li><code>_</code> (underscore)</li><li><code>^</code> (caret)</li></ul><p>These <code>a</code>, <code>ctrl-a</code>, <code>X</code>, or <code>ctrl-\\</code> values are all examples of valid key
sequences. To configure a different configuration default key sequence for all
containers, see
<a class=link href="../../../../../engine/reference/commandline/cli/index.html#configuration-files"><strong>Configuration file</strong> section</a>.</p><h3 class=scroll-mt-20 id=device><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#device">Add host device to container (--device)</a></h3><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pdCAtLXJtIFwKICAgIC0tZGV2aWNlPS9kZXYvc2RjOi9kZXYveHZkYyBcCiAgICAtLWRldmljZT0vZGV2L3NkZCBcCiAgICAtLWRldmljZT0vZGV2L3plcm86L2Rldi9mb29iYXIgXAogICAgdWJ1bnR1IGxzIC1sIC9kZXYve3h2ZGMsc2RkLGZvb2Jhcn0KCmJydy1ydy0tLS0gMSByb290IGRpc2sgOCwgMiBGZWIgIDkgMTY6MDUgL2Rldi94dmRjCmJydy1ydy0tLS0gMSByb290IGRpc2sgOCwgMyBGZWIgIDkgMTY6MDUgL2Rldi9zZGQKY3J3LXJ3LXJ3LSAxIHJvb3Qgcm9vdCAxLCA1IEZlYiAgOSAxNjowNSAvZGV2L2Zvb2Jhcg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -it --rm <span class=se>\
</span></span></span><span class=line><span class=cl><span class=se></span><span class=go>    --device=/dev/sdc:/dev/xvdc \
</span></span></span><span class=line><span class=cl><span class=go>    --device=/dev/sdd \
</span></span></span><span class=line><span class=cl><span class=go>    --device=/dev/zero:/dev/foobar \
</span></span></span><span class=line><span class=cl><span class=go>    ubuntu ls -l /dev/{xvdc,sdd,foobar}
</span></span></span><span class=line><span class=cl><span class=go></span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=go>brw-rw---- 1 root disk 8, 2 Feb  9 16:05 /dev/xvdc
</span></span></span><span class=line><span class=cl><span class=go>brw-rw---- 1 root disk 8, 3 Feb  9 16:05 /dev/sdd
</span></span></span><span class=line><span class=cl><span class=go>crw-rw-rw- 1 root root 1, 5 Feb  9 16:05 /dev/foobar
</span></span></span></code></pre></div></div></div><p>It's often necessary to directly expose devices to a container. The <code>--device</code>
option enables that. For example, adding a specific block storage device or loop
device or audio device to an otherwise unprivileged container
(without the <code>--privileged</code> flag) and have the application directly access it.</p><p>By default, the container is able to <code>read</code>, <code>write</code> and <code>mknod</code> these devices.
This can be overridden using a third <code>:rwm</code> set of options to each <code>--device</code>
flag. If the container is running in privileged mode, then Docker ignores the
specified permissions.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tZGV2aWNlPS9kZXYvc2RhOi9kZXYveHZkYyAtLXJtIC1pdCB1YnVudHUgZmRpc2sgIC9kZXYveHZkYwoKQ29tbWFuZCAobSBmb3IgaGVscCk6IHEKJCBkb2NrZXIgcnVuIC0tZGV2aWNlPS9kZXYvc2RhOi9kZXYveHZkYzpyIC0tcm0gLWl0IHVidW50dSBmZGlzayAgL2Rldi94dmRjCllvdSB3aWxsIG5vdCBiZSBhYmxlIHRvIHdyaXRlIHRoZSBwYXJ0aXRpb24gdGFibGUuCgpDb21tYW5kIChtIGZvciBoZWxwKTogcQoKJCBkb2NrZXIgcnVuIC0tZGV2aWNlPS9kZXYvc2RhOi9kZXYveHZkYzpydyAtLXJtIC1pdCB1YnVudHUgZmRpc2sgIC9kZXYveHZkYwoKQ29tbWFuZCAobSBmb3IgaGVscCk6IHEKCiQgZG9ja2VyIHJ1biAtLWRldmljZT0vZGV2L3NkYTovZGV2L3h2ZGM6bSAtLXJtIC1pdCB1YnVudHUgZmRpc2sgIC9kZXYveHZkYwpmZGlzazogdW5hYmxlIHRvIG9wZW4gL2Rldi94dmRjOiBPcGVyYXRpb24gbm90IHBlcm1pdHRlZA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --device<span class=o>=</span>/dev/sda:/dev/xvdc --rm -it ubuntu fdisk  /dev/xvdc
</span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=go>Command (m for help): q
</span></span></span><span class=line><span class=cl><span class=go></span><span class=gp>$</span> docker run --device<span class=o>=</span>/dev/sda:/dev/xvdc:r --rm -it ubuntu fdisk  /dev/xvdc
</span></span><span class=line><span class=cl><span class=go>You will not be able to write the partition table.
</span></span></span><span class=line><span class=cl><span class=go></span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=go>Command (m for help): q
</span></span></span><span class=line><span class=cl><span class=go></span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>$</span> docker run --device<span class=o>=</span>/dev/sda:/dev/xvdc:rw --rm -it ubuntu fdisk  /dev/xvdc
</span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=go>Command (m for help): q
</span></span></span><span class=line><span class=cl><span class=go></span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>$</span> docker run --device<span class=o>=</span>/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk  /dev/xvdc
</span></span><span class=line><span class=cl><span class=go>fdisk: unable to open /dev/xvdc: Operation not permitted
</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>The <code>--device</code> option cannot be safely used with ephemeral devices. You shouldn't
add block devices that may be removed to untrusted containers with <code>--device</code>.</p></blockquote><p>For Windows, the format of the string passed to the <code>--device</code> option is in
the form of <code>--device=&lt;IdType>/&lt;Id></code>. Beginning with Windows Server 2019
and Windows 10 October 2018 Update, Windows only supports an IdType of
<code>class</code> and the Id as a
<a class=link href=https://docs.microsoft.com/en-us/windows-hardware/drivers/install/overview-of-device-interface-classes target=_blank rel=noopener>device interface class
GUID<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.
Refer to the table defined in the
<a class=link href=https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/hardware-devices-in-containers target=_blank rel=noopener>Windows container
docs<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
for a list of container-supported device interface class GUIDs.</p><p>If you specify this option for a process-isolated Windows container, Docker makes
<em>all</em> devices that implement the requested device interface class GUID
available in the container. For example, the command below makes all COM
ports on the host visible in the container.</p><div class="group relative"><button x-data="{ code: 'UFMgQzpcPiBkb2NrZXIgcnVuIC0tZGV2aWNlPWNsYXNzLzg2RTBEMUUwLTgwODktMTFEMC05Q0U0LTA4MDAzRTMwMUY3MyBtY3IubWljcm9zb2Z0LmNvbS93aW5kb3dzL3NlcnZlcmNvcmU6bHRzYzIwMTk=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-powershell data-lang=powershell><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=p>-</span><span class=n>-device</span><span class=p>=</span><span class=n>class</span><span class=p>/</span><span class=n>86E0D1E0</span><span class=p>-</span><span class=mf>8089</span><span class=p>-</span><span class=n>11D0</span><span class=p>-</span><span class=n>9CE4</span><span class=p>-</span><span class=n>08003E301F73</span> <span class=n>mcr</span><span class=p>.</span><span class=py>microsoft</span><span class=p>.</span><span class=n>com</span><span class=p>/</span><span class=n>windows</span><span class=p>/</span><span class=n>servercore</span><span class=err>:</span><span class=n>ltsc2019</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>The <code>--device</code> option is only supported on process-isolated Windows containers,
and produces an error if the container isolation is <code>hyperv</code>.</p></blockquote><h4 class=scroll-mt-20 id=cdi-devices><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#cdi-devices">CDI devices</a></h4><blockquote><p><strong>Note</strong></p><p>This is experimental feature and as such doesn't represent a stable API.</p></blockquote><p>Container Device Interface (CDI) is a
<a class=link href=https://github.com/cncf-tags/container-device-interface/blob/main/SPEC.md target=_blank rel=noopener>standardized<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
mechanism for container runtimes to create containers which are able to
interact with third party devices.</p><p>With CDI, device configurations are defined using a JSON file. In addition to
enabling the container to interact with the device node, it also lets you
specify additional configuration for the device, such as kernel modules, host
libraries, and environment variables.</p><p>You can reference a CDI device with the <code>--device</code> flag using the
fully-qualified name of the device, as shown in the following example:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tZGV2aWNlPXZlbmRvci5jb20vY2xhc3M9ZGV2aWNlLW5hbWUgLS1ybSAtaXQgdWJ1bnR1', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --device<span class=o>=</span>vendor.com/class<span class=o>=</span>device-name --rm -it ubuntu
</span></span></code></pre></div></div></div><p>This starts an <code>ubuntu</code> container with access to the specified CDI device,
<code>vendor.com/class=device-name</code>, assuming that:</p><ul><li>A valid CDI specification (JSON file) for the requested device is available
on the system running the daemon, in one of the configured CDI specification
directories.</li><li>The CDI feature has been enabled on the daemon side, see
<a class=link href="../../../../../engine/reference/commandline/dockerd/index.html#enable-cdi-devices">Enable CDI
devices</a>.</li></ul><h3 class=scroll-mt-20 id=attach><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#attach">Attach to STDIN/STDOUT/STDERR (-a, --attach)</a></h3><p>The <code>--attach</code> (or <code>-a</code>) flag tells <code>docker run</code> to bind to the container's
<code>STDIN</code>, <code>STDOUT</code> or <code>STDERR</code>. This makes it possible to manipulate the output
and input as needed. You can specify to which of the three standard streams
(<code>STDIN</code>, <code>STDOUT</code>, <code>STDERR</code>) you'd like to connect instead, as in:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1hIHN0ZGluIC1hIHN0ZG91dCAtaSAtdCB1YnVudHUgL2Jpbi9iYXNo', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -a stdin -a stdout -i -t ubuntu /bin/bash
</span></span></code></pre></div></div></div><p>The following example pipes data into a container and prints the container's ID
by attaching only to the container's <code>STDIN</code>.</p><div class="group relative"><button x-data="{ code: 'JCBlY2hvICJ0ZXN0IiB8IGRvY2tlciBydW4gLWkgLWEgc3RkaW4gdWJ1bnR1IGNhdCAt', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> <span class=nb>echo</span> <span class=s2>&#34;test&#34;</span> <span class=p>|</span> docker run -i -a stdin ubuntu cat -
</span></span></code></pre></div></div></div><p>The following example doesn't print anything to the console unless there's an
error because output is only attached to the <code>STDERR</code> of the container. The
container's logs still store what's written to <code>STDERR</code> and <code>STDOUT</code>.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1hIHN0ZGVyciB1YnVudHUgZWNobyB0ZXN0', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -a stderr ubuntu <span class=nb>echo</span> <span class=nb>test</span>
</span></span></code></pre></div></div></div><p>The following example shows a way of using <code>--attach</code> to pipe a file into a
container. The command prints the container's ID after the build completes and
you can retrieve the build logs using <code>docker logs</code>. This is useful if you need
to pipe a file or something else into a container and retrieve the container's
ID once the container has finished running.</p><div class="group relative"><button x-data="{ code: 'JCBjYXQgc29tZWZpbGUgfCBkb2NrZXIgcnVuIC1pIC1hIHN0ZGluIG15YnVpbGRlciBkb2J1aWxk', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> cat somefile <span class=p>|</span> docker run -i -a stdin mybuilder dobuild
</span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>A process running as PID 1 inside a container is treated specially by
Linux: it ignores any signal with the default action. So, the process
doesn't terminate on <code>SIGINT</code> or <code>SIGTERM</code> unless it's coded to do so.</p></blockquote><p>See also
<a class=link href="../cp/index.html">the <code>docker cp</code> command</a>.</p><h3 class=scroll-mt-20 id=interactive><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#interactive">Keep STDIN open (-i, --interactive)</a></h3><p>The <code>--interactive</code> (or <code>-i</code>) flag keeps the container's <code>STDIN</code> open, and lets
you send input to the container through standard input.</p><div class="group relative"><button x-data="{ code: 'JCBlY2hvIGhlbGxvIHwgZG9ja2VyIHJ1biAtLXJtIC1pIGJ1c3lib3ggY2F0CmhlbGxv', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> <span class=nb>echo</span> hello <span class=p>|</span> docker run --rm -i busybox cat
</span></span><span class=line><span class=cl><span class=go>hello
</span></span></span></code></pre></div></div></div><p>The <code>-i</code> flag is most often used together with the <code>--tty</code> flag to bind the I/O
streams of the container to a pseudo terminal, creating an interactive terminal
session for the container. See
<a class=link href="../../../../../engine/reference/commandline/run/index.html#tty">Allocate a pseudo-TTY</a> for more examples.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pdCBkZWJpYW4Kcm9vdEAxMGEzZTcxNDkyYjA6LyMgZmFjdG9yIDkwCjkwOiAyIDMgMyA1CnJvb3RAMTBhM2U3MTQ5MmIwOi8jIGV4aXQKZXhpdA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -it debian
</span></span><span class=line><span class=cl><span class=go>root@10a3e71492b0:/# factor 90
</span></span></span><span class=line><span class=cl><span class=go>90: 2 3 3 5
</span></span></span><span class=line><span class=cl><span class=go>root@10a3e71492b0:/# exit
</span></span></span><span class=line><span class=cl><span class=go>exit
</span></span></span></code></pre></div></div></div><p>Using the <code>-i</code> flag on its own allows for composition, such as piping input to
containers:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcm0gLWkgYnVzeWJveCBlY2hvICJmb28gYmFyIGJheiIgXAogIHwgZG9ja2VyIHJ1biAtLXJtIC1pIGJ1c3lib3ggYXdrICd7IHByaW50ICQyIH0nIFwKICB8IGRvY2tlciBydW4gLS1ybSAtaSBidXN5Ym94IHJldgpyYWI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --rm -i busybox <span class=nb>echo</span> <span class=s2>&#34;foo bar baz&#34;</span> <span class=se>\
</span></span></span><span class=line><span class=cl><span class=se></span><span class=go>  | docker run --rm -i busybox awk &#39;{ print $2 }&#39; \
</span></span></span><span class=line><span class=cl><span class=go>  | docker run --rm -i busybox rev
</span></span></span><span class=line><span class=cl><span class=go>rab
</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=init><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#init">Specify an init process</a></h3><p>You can use the <code>--init</code> flag to indicate that an init process should be used as
the PID 1 in the container. Specifying an init process ensures the usual
responsibilities of an init system, such as reaping zombie processes, are
performed inside the created container.</p><p>The default init process used is the first <code>docker-init</code> executable found in the
system path of the Docker daemon process. This <code>docker-init</code> binary, included in
the default installation, is backed by
<a class=link href=https://github.com/krallin/tini target=_blank rel=noopener>tini<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p><h3 class=scroll-mt-20 id=tty><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#tty">Allocate a pseudo-TTY (-t, --tty)</a></h3><p>The <code>--tty</code> (or <code>-t</code>) flag attaches a pseudo-TTY to the container, connecting
your terminal to the I/O streams of the container. Allocating a pseudo-TTY to
the container means that you get access to input and output feature that TTY
devices provide.</p><p>For example, the following command runs the <code>passwd</code> command in a <code>debian</code>
container, to set a new password for the <code>root</code> user.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pIGRlYmlhbiBwYXNzd2Qgcm9vdApOZXcgcGFzc3dvcmQ6IGthcmphbGFucGlpcmFra2E5ClJldHlwZSBuZXcgcGFzc3dvcmQ6IGthcmphbGFucGlpcmFra2E5CnBhc3N3ZDogcGFzc3dvcmQgdXBkYXRlZCBzdWNjZXNzZnVsbHk=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -i debian passwd root
</span></span><span class=line><span class=cl><span class=go>New password: karjalanpiirakka9
</span></span></span><span class=line><span class=cl><span class=go>Retype new password: karjalanpiirakka9
</span></span></span><span class=line><span class=cl><span class=go>passwd: password updated successfully
</span></span></span></code></pre></div></div></div><p>If you run this command with only the <code>-i</code> flag (which lets you send text to
<code>STDIN</code> of the container), the <code>passwd</code> prompt displays the password in plain
text. However, if you try the same thing but also adding the <code>-t</code> flag, the
password is hidden:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pIGRlYmlhbiBwYXNzd2Qgcm9vdApOZXcgcGFzc3dvcmQ6ClJldHlwZSBuZXcgcGFzc3dvcmQ6CnBhc3N3ZDogcGFzc3dvcmQgdXBkYXRlZCBzdWNjZXNzZnVsbHk=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -i debian passwd root
</span></span><span class=line><span class=cl><span class=go>New password:
</span></span></span><span class=line><span class=cl><span class=go>Retype new password:
</span></span></span><span class=line><span class=cl><span class=go>passwd: password updated successfully
</span></span></span></code></pre></div></div></div><p>This is because <code>passwd</code> can suppress the output of characters to the terminal
using the echo-off TTY feature.</p><p>You can use the <code>-t</code> flag without <code>-i</code> flag. This still allocates a pseudo-TTY
to the container, but with no way of writing to <code>STDIN</code>. The only time this
might be useful is if the output of the container requires a TTY environment.</p><h3 class=scroll-mt-20 id=cgroup-parent><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#cgroup-parent">Specify custom cgroups</a></h3><p>Using the <code>--cgroup-parent</code> flag, you can pass a specific cgroup to run a
container in. This allows you to create and manage cgroups on their own. You can
define custom resources for those cgroups and put containers under a common
parent group.</p><h3 class=scroll-mt-20 id=device-cgroup-rule><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#device-cgroup-rule">Using dynamically created devices (--device-cgroup-rule)</a></h3><p>Docker assigns devices available to a container at creation time. The
assigned devices are added to the cgroup.allow file and
created into the container when it runs. This poses a problem when
you need to add a new device to running container.</p><p>One solution is to add a more permissive rule to a container
allowing it access to a wider range of devices. For example, supposing
the container needs access to a character device with major <code>42</code> and
any number of minor numbers (added as new devices appear), add the
following rule:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1kIC0tZGV2aWNlLWNncm91cC1ydWxlPSdjIDQyOiogcm13JyAtLW5hbWUgbXktY29udGFpbmVyIG15LWltYWdl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -d --device-cgroup-rule<span class=o>=</span><span class=s1>&#39;c 42:* rmw&#39;</span> --name my-container my-image
</span></span></code></pre></div></div></div><p>Then, a user could ask <code>udev</code> to execute a script that would <code>docker exec my-container mknod newDevX c 42 &lt;minor></code>
the required device when it is added.</p><blockquote><p><strong>Note</strong>: You still need to explicitly add initially present devices to the
<code>docker run</code> / <code>docker create</code> command.</p></blockquote><h3 class=scroll-mt-20 id=gpus><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#gpus">Access an NVIDIA GPU</a></h3><p>The <code>--gpus</code> flag allows you to access NVIDIA GPU resources. First you need to
install the
<a class=link href=https://nvidia.github.io/nvidia-container-runtime/ target=_blank rel=noopener>nvidia-container-runtime<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p><blockquote><p><strong>Note</strong></p><p>You can also specify a GPU as a CDI device with the <code>--device</code> flag, see
<a class=link href="../../../../../engine/reference/commandline/run/index.html#cdi-devices">CDI devices</a>.</p></blockquote><p>Read
<a class=link href="../../../../../config/containers/resource_constraints/index.html">Specify a container's resources</a>
for more information.</p><p>To use <code>--gpus</code>, specify which GPUs (or all) to use. If you provide no value, Docker uses all
available GPUs. The example below exposes all available GPUs.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pdCAtLXJtIC0tZ3B1cyBhbGwgdWJ1bnR1IG52aWRpYS1zbWk=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -it --rm --gpus all ubuntu nvidia-smi
</span></span></code></pre></div></div></div><p>Use the <code>device</code> option to specify GPUs. The example below exposes a specific
GPU.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pdCAtLXJtIC0tZ3B1cyBkZXZpY2U9R1BVLTNhMjNjNjY5LTFmNjktYzY0ZS1jZjg1LTQ0ZTliMDdlN2EyYSB1YnVudHUgbnZpZGlhLXNtaQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -it --rm --gpus <span class=nv>device</span><span class=o>=</span>GPU-3a23c669-1f69-c64e-cf85-44e9b07e7a2a ubuntu nvidia-smi
</span></span></code></pre></div></div></div><p>The example below exposes the first and third GPUs.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pdCAtLXJtIC0tZ3B1cyAnImRldmljZT0wLDIiJyB1YnVudHUgbnZpZGlhLXNtaQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -it --rm --gpus <span class=s1>&#39;&#34;device=0,2&#34;&#39;</span> ubuntu nvidia-smi
</span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=restart><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#restart">Restart policies (--restart)</a></h3><p>Use the <code>--restart</code> flag to specify a container's <em>restart policy</em>. A restart
policy controls whether the Docker daemon restarts a container after exit.
Docker supports the following restart policies:</p><table><thead><tr><th style=text-align:left>Policy</th><th style=text-align:left>Result</th></tr></thead><tbody><tr><td style=text-align:left><code>no</code></td><td style=text-align:left>Do not automatically restart the container when it exits. This is the default.</td></tr><tr><td style=text-align:left><code>on-failure[:max-retries]</code></td><td style=text-align:left>Restart only if the container exits with a non-zero exit status. Optionally, limit the number of restart retries the Docker daemon attempts.</td></tr><tr><td style=text-align:left><code>unless-stopped</code></td><td style=text-align:left>Restart the container unless it's explicitly stopped or Docker itself is stopped or restarted.</td></tr><tr><td style=text-align:left><code>always</code></td><td style=text-align:left>Always restart the container regardless of the exit status. When you specify always, the Docker daemon tries to restart the container indefinitely. The container always starts on daemon startup, regardless of the current state of the container.</td></tr></tbody></table><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcmVzdGFydD1hbHdheXMgcmVkaXM=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --restart<span class=o>=</span>always redis
</span></span></code></pre></div></div></div><p>This runs the <code>redis</code> container with a restart policy of <strong>always</strong>.
If the container exits, Docker restarts it.</p><p>When a restart policy is active on a container, it shows as either <code>Up</code> or
<code>Restarting</code> in
<a class=link href="../../ps/index.html"><code>docker ps</code></a>. It can also be useful to use
<a class=link href="../../system/events/index.html"><code>docker events</code></a> to see the restart policy in effect.</p><p>An increasing delay (double the previous delay, starting at 100 milliseconds)
is added before each restart to prevent flooding the server. This means the
daemon waits for 100 ms, then 200 ms, 400, 800, 1600, and so on until either
the <code>on-failure</code> limit, the maximum delay of 1 minute is hit, or when you
<code>docker stop</code> or <code>docker rm -f</code> the container.</p><p>If a container is successfully restarted (the container is started and runs
for at least 10 seconds), the delay is reset to its default value of 100 ms.</p><h4 class=scroll-mt-20 id=specify-a-limit-for-restart-attempts><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#specify-a-limit-for-restart-attempts">Specify a limit for restart attempts</a></h4><p>You can specify the maximum amount of times Docker attempts to restart the
container when using the <strong>on-failure</strong> policy. By default, Docker never stops
attempting to restart the container.</p><p>The following example runs the <code>redis</code> container with a restart policy of
<strong>on-failure</strong> and a maximum restart count of 10.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcmVzdGFydD1vbi1mYWlsdXJlOjEwIHJlZGlz', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --restart<span class=o>=</span>on-failure:10 redis
</span></span></code></pre></div></div></div><p>If the <code>redis</code> container exits with a non-zero exit status more than 10 times
in a row, Docker stops trying to restart the container. Providing a maximum
restart limit is only valid for the <strong>on-failure</strong> policy.</p><h4 class=scroll-mt-20 id=inspect-container-restarts><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#inspect-container-restarts">Inspect container restarts</a></h4><p>The number of (attempted) restarts for a container can be obtained using the
<a class=link href="../../inspect/index.html"><code>docker inspect</code></a> command. For example, to get the number of
restarts for container "my-container";</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgaW5zcGVjdCAtZiAie3sgLlJlc3RhcnRDb3VudCB9fSIgbXktY29udGFpbmVyCjI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker inspect -f <span class=s2>&#34;{{ .RestartCount }}&#34;</span> my-container
</span></span><span class=line><span class=cl><span class=go>2
</span></span></span></code></pre></div></div></div><p>Or, to get the last time the container was (re)started;</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgaW5zcGVjdCAtZiAie3sgLlN0YXRlLlN0YXJ0ZWRBdCB9fSIgbXktY29udGFpbmVyCjIwMTUtMDMtMDRUMjM6NDc6MDcuNjkxODQwMTc5Wg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker inspect -f <span class=s2>&#34;{{ .State.StartedAt }}&#34;</span> my-container
</span></span><span class=line><span class=cl><span class=go>2015-03-04T23:47:07.691840179Z
</span></span></span></code></pre></div></div></div><p>Combining <code>--restart</code> (restart policy) with the <code>--rm</code> (clean up) flag results
in an error. On container restart, attached clients are disconnected.</p><h3 class=scroll-mt-20 id=rm><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#rm">Clean up (--rm)</a></h3><p>By default, a container's file system persists even after the container exits.
This makes debugging a lot easier, since you can inspect the container's final
state and you retain all your data.</p><p>If you are running short-term <strong>foreground</strong> processes, these container file
systems can start to pile up. If you'd like Docker to automatically clean up
the container and remove the file system when the container exits, use the
<code>--rm</code> flag:</p><div class="group relative"><button x-data="{ code: 'LS1ybT1mYWxzZTogQXV0b21hdGljYWxseSByZW1vdmUgdGhlIGNvbnRhaW5lciB3aGVuIGl0IGV4aXRz', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-text data-lang=text><span class=line><span class=cl>--rm=false: Automatically remove the container when it exits</span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>If you set the <code>--rm</code> flag, Docker also removes the anonymous volumes
associated with the container when the container is removed. This is similar
to running <code>docker rm -v my-container</code>. Only volumes that are specified
without a name are removed. For example, when running the following command,
volume <code>/foo</code> is removed, but not <code>/bar</code>:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tcm0gLXYgL2ZvbyAtdiBhd2Vzb21lOi9iYXIgYnVzeWJveCB0b3A=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --rm -v /foo -v awesome:/bar busybox top
</span></span></code></pre></div></div></div><p>Volumes inherited via <code>--volumes-from</code> are removed with the same logic:
if the original volume was specified with a name it isn't removed.</p></blockquote><h3 class=scroll-mt-20 id=add-host><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#add-host">Add entries to container hosts file (--add-host)</a></h3><p>You can add other hosts into a container's <code>/etc/hosts</code> file by using one or
more <code>--add-host</code> flags. This example adds a static address for a host named
<code>my-hostname</code>:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tYWRkLWhvc3Q9bXktaG9zdG5hbWU9OC44LjguOCAtLXJtIC1pdCBhbHBpbmUKCi8gIyBwaW5nIG15LWhvc3RuYW1lClBJTkcgbXktaG9zdG5hbWUgKDguOC44LjgpOiA1NiBkYXRhIGJ5dGVzCjY0IGJ5dGVzIGZyb20gOC44LjguODogc2VxPTAgdHRsPTM3IHRpbWU9OTMuMDUyIG1zCjY0IGJ5dGVzIGZyb20gOC44LjguODogc2VxPTEgdHRsPTM3IHRpbWU9OTIuNDY3IG1zCjY0IGJ5dGVzIGZyb20gOC44LjguODogc2VxPTIgdHRsPTM3IHRpbWU9OTIuMjUyIG1zCl5DCi0tLSBteS1ob3N0bmFtZSBwaW5nIHN0YXRpc3RpY3MgLS0tCjQgcGFja2V0cyB0cmFuc21pdHRlZCwgNCBwYWNrZXRzIHJlY2VpdmVkLCAwJSBwYWNrZXQgbG9zcwpyb3VuZC10cmlwIG1pbi9hdmcvbWF4ID0gOTIuMjA5LzkyLjQ5NS85My4wNTIgbXM=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --add-host<span class=o>=</span>my-hostname<span class=o>=</span>8.8.8.8 --rm -it alpine
</span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=go>/ # ping my-hostname
</span></span></span><span class=line><span class=cl><span class=go>PING my-hostname (8.8.8.8): 56 data bytes
</span></span></span><span class=line><span class=cl><span class=go>64 bytes from 8.8.8.8: seq=0 ttl=37 time=93.052 ms
</span></span></span><span class=line><span class=cl><span class=go>64 bytes from 8.8.8.8: seq=1 ttl=37 time=92.467 ms
</span></span></span><span class=line><span class=cl><span class=go>64 bytes from 8.8.8.8: seq=2 ttl=37 time=92.252 ms
</span></span></span><span class=line><span class=cl><span class=go>^C
</span></span></span><span class=line><span class=cl><span class=go>--- my-hostname ping statistics ---
</span></span></span><span class=line><span class=cl><span class=go>4 packets transmitted, 4 packets received, 0% packet loss
</span></span></span><span class=line><span class=cl><span class=go>round-trip min/avg/max = 92.209/92.495/93.052 ms
</span></span></span></code></pre></div></div></div><p>You can wrap an IPv6 address in square brackets:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tYWRkLWhvc3QgbXktaG9zdG5hbWU9WzIwMDE6ZGI4OjozM10gLS1ybSAtaXQgYWxwaW5l', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --add-host my-hostname<span class=o>=[</span>2001:db8::33<span class=o>]</span> --rm -it alpine
</span></span></code></pre></div></div></div><p>The <code>--add-host</code> flag supports a special <code>host-gateway</code> value that resolves to
the internal IP address of the host. This is useful when you want containers to
connect to services running on the host machine.</p><p>It's conventional to use <code>host.docker.internal</code> as the hostname referring to
<code>host-gateway</code>. Docker Desktop automatically resolves this hostname, see
<a class=link href="../../../../../desktop/networking/index.html#i-want-to-connect-from-a-container-to-a-service-on-the-host">Explore networking features</a>.</p><p>The following example shows how the special <code>host-gateway</code> value works. The
example runs an HTTP server that serves a file from host to container over the
<code>host.docker.internal</code> hostname, which resolves to the host's internal IP.</p><div class="group relative"><button x-data="{ code: 'JCBlY2hvICJoZWxsbyBmcm9tIGhvc3QhIiA+IC4vaGVsbG8KJCBweXRob24zIC1tIGh0dHAuc2VydmVyIDgwMDAKU2VydmluZyBIVFRQIG9uIDAuMC4wLjAgcG9ydCA4MDAwIChodHRwOi8vMC4wLjAuMDo4MDAwLykgLi4uCiQgZG9ja2VyIHJ1biBcCiAgLS1hZGQtaG9zdCBob3N0LmRvY2tlci5pbnRlcm5hbD1ob3N0LWdhdGV3YXkgXAogIGN1cmxpbWFnZXMvY3VybCAtcyBob3N0LmRvY2tlci5pbnRlcm5hbDo4MDAwL2hlbGxvCmhlbGxvIGZyb20gaG9zdCE=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> <span class=nb>echo</span> <span class=s2>&#34;hello from host!&#34;</span> &gt; ./hello
</span></span><span class=line><span class=cl><span class=gp>$</span> python3 -m http.server <span class=m>8000</span>
</span></span><span class=line><span class=cl><span class=go>Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
</span></span></span><span class=line><span class=cl><span class=go></span><span class=gp>$</span> docker run <span class=se>\
</span></span></span><span class=line><span class=cl><span class=se></span><span class=go>  --add-host host.docker.internal=host-gateway \
</span></span></span><span class=line><span class=cl><span class=go>  curlimages/curl -s host.docker.internal:8000/hello
</span></span></span><span class=line><span class=cl><span class=go>hello from host!
</span></span></span></code></pre></div></div></div><p>The <code>--add-host</code> flag also accepts a <code>:</code> separator, for example:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tYWRkLWhvc3Q9bXktaG9zdG5hbWU6OC44LjguOCAtLXJtIC1pdCBhbHBpbmU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --add-host<span class=o>=</span>my-hostname:8.8.8.8 --rm -it alpine
</span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=log-driver><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#log-driver">Logging drivers (--log-driver)</a></h3><p>The container can have a different logging driver than the Docker daemon. Use
the <code>--log-driver=&lt;DRIVER></code> with the <code>docker run</code> command to configure the
container's logging driver.</p><p>To learn about the supported logging drivers and how to use them, refer to
<a class=link href="../../../../../config/containers/logging/configure/index.html">Configure logging drivers</a>.</p><p>To disable logging for a container, set the <code>--log-driver</code> flag to <code>none</code>:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tbG9nLWRyaXZlcj1ub25lIC1kIG5naW54OmFscGluZQo1MTAxZDNiN2ZlOTMxYzI3YzJiYTBlNjVmZDk4OTY1NGQyOTczOTNhZDY1YWUyMzhmMjBiOTdhMDIwZTcyOTViCiQgZG9ja2VyIGxvZ3MgNTEwMWQzYgpFcnJvciByZXNwb25zZSBmcm9tIGRhZW1vbjogY29uZmlndXJlZCBsb2dnaW5nIGRyaXZlciBkb2VzIG5vdCBzdXBwb3J0IHJlYWRpbmc=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --log-driver<span class=o>=</span>none -d nginx:alpine
</span></span><span class=line><span class=cl><span class=go>5101d3b7fe931c27c2ba0e65fd989654d297393ad65ae238f20b97a020e7295b
</span></span></span><span class=line><span class=cl><span class=go></span><span class=gp>$</span> docker logs 5101d3b
</span></span><span class=line><span class=cl><span class=go>Error response from daemon: configured logging driver does not support reading
</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=ulimit><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#ulimit">Set ulimits in container (--ulimit)</a></h3><p>Since setting <code>ulimit</code> settings in a container requires extra privileges not
available in the default container, you can set these using the <code>--ulimit</code> flag.
Specify <code>--ulimit</code> with a soft and hard limit in the format
<code>&lt;type>=&lt;soft limit>[:&lt;hard limit>]</code>. For example:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tdWxpbWl0IG5vZmlsZT0xMDI0OjEwMjQgLS1ybSBkZWJpYW4gc2ggLWMgInVsaW1pdCAtbiIKMTAyNA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --ulimit <span class=nv>nofile</span><span class=o>=</span>1024:1024 --rm debian sh -c <span class=s2>&#34;ulimit -n&#34;</span>
</span></span><span class=line><span class=cl><span class=go>1024
</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>If you don't provide a hard limit value, Docker uses the soft limit value
for both values. If you don't provide any values, they are inherited from
the default <code>ulimits</code> set on the daemon.</p></blockquote><blockquote><p><strong>Note</strong></p><p>The <code>as</code> option is deprecated.
In other words, the following script is not supported:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1pdCAtLXVsaW1pdCBhcz0xMDI0IGZlZG9yYSAvYmluL2Jhc2g=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -it --ulimit <span class=nv>as</span><span class=o>=</span><span class=m>1024</span> fedora /bin/bash
</span></span></code></pre></div></div></div></blockquote><p>Docker sends the values to the appropriate OS <code>syscall</code> and doesn't perform any byte conversion.
Take this into account when setting the values.</p><h4 class=scroll-mt-20 id=for-nproc-usage><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#for-nproc-usage">For nproc usage</a></h4><p>Be careful setting <code>nproc</code> with the <code>ulimit</code> flag as Linux uses <code>nproc</code> to set the
maximum number of processes available to a user, not to a container. For example, start four
containers with <code>daemon</code> user:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1kIC11IGRhZW1vbiAtLXVsaW1pdCBucHJvYz0zIGJ1c3lib3ggdG9wCgokIGRvY2tlciBydW4gLWQgLXUgZGFlbW9uIC0tdWxpbWl0IG5wcm9jPTMgYnVzeWJveCB0b3AKCiQgZG9ja2VyIHJ1biAtZCAtdSBkYWVtb24gLS11bGltaXQgbnByb2M9MyBidXN5Ym94IHRvcAoKJCBkb2NrZXIgcnVuIC1kIC11IGRhZW1vbiAtLXVsaW1pdCBucHJvYz0zIGJ1c3lib3ggdG9w', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -d -u daemon --ulimit <span class=nv>nproc</span><span class=o>=</span><span class=m>3</span> busybox top
</span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>$</span> docker run -d -u daemon --ulimit <span class=nv>nproc</span><span class=o>=</span><span class=m>3</span> busybox top
</span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>$</span> docker run -d -u daemon --ulimit <span class=nv>nproc</span><span class=o>=</span><span class=m>3</span> busybox top
</span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=gp>$</span> docker run -d -u daemon --ulimit <span class=nv>nproc</span><span class=o>=</span><span class=m>3</span> busybox top
</span></span></code></pre></div></div></div><p>The 4th container fails and reports a "[8] System error: resource temporarily unavailable" error.
This fails because the caller set <code>nproc=3</code> resulting in the first three containers using up
the three processes quota set for the <code>daemon</code> user.</p><h3 class=scroll-mt-20 id=stop-signal><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#stop-signal">Stop container with signal (--stop-signal)</a></h3><p>The <code>--stop-signal</code> flag sends the system call signal to the
container to exit. This signal can be a signal name in the format <code>SIG&lt;NAME></code>,
for instance <code>SIGKILL</code>, or an unsigned number that matches a position in the
kernel's syscall table, for instance <code>9</code>.</p><p>The default value is defined by
<a class=link href="../../../../../engine/reference/builder/index.html#stopsignal"><code>STOPSIGNAL</code></a>
in the image, or <code>SIGTERM</code> if the image has no <code>STOPSIGNAL</code> defined.</p><h3 class=scroll-mt-20 id=security-opt><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#security-opt">Optional security options (--security-opt)</a></h3><table><thead><tr><th style=text-align:left>Option</th><th style=text-align:left>Description</th></tr></thead><tbody><tr><td style=text-align:left><code>--security-opt="label=user:USER"</code></td><td style=text-align:left>Set the label user for the container</td></tr><tr><td style=text-align:left><code>--security-opt="label=role:ROLE"</code></td><td style=text-align:left>Set the label role for the container</td></tr><tr><td style=text-align:left><code>--security-opt="label=type:TYPE"</code></td><td style=text-align:left>Set the label type for the container</td></tr><tr><td style=text-align:left><code>--security-opt="label=level:LEVEL"</code></td><td style=text-align:left>Set the label level for the container</td></tr><tr><td style=text-align:left><code>--security-opt="label=disable"</code></td><td style=text-align:left>Turn off label confinement for the container</td></tr><tr><td style=text-align:left><code>--security-opt="apparmor=PROFILE"</code></td><td style=text-align:left>Set the apparmor profile to be applied to the container</td></tr><tr><td style=text-align:left><code>--security-opt="no-new-privileges=true"</code></td><td style=text-align:left>Disable container processes from gaining new privileges</td></tr><tr><td style=text-align:left><code>--security-opt="seccomp=unconfined"</code></td><td style=text-align:left>Turn off seccomp confinement for the container</td></tr><tr><td style=text-align:left><code>--security-opt="seccomp=builtin"</code></td><td style=text-align:left>Use the default (built-in) seccomp profile for the container. This can be used to enable seccomp for a container running on a daemon with a custom default profile set, or with seccomp disabled ("unconfined").</td></tr><tr><td style=text-align:left><code>--security-opt="seccomp=profile.json"</code></td><td style=text-align:left>White-listed syscalls seccomp Json file to be used as a seccomp filter</td></tr></tbody></table><p>The <code>--security-opt</code> flag lets you override the default labeling scheme for a
container. Specifying the level in the following command allows you to share
the same content between containers.</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tc2VjdXJpdHktb3B0IGxhYmVsPWxldmVsOnMwOmMxMDAsYzIwMCAtaXQgZmVkb3JhIGJhc2g=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --security-opt <span class=nv>label</span><span class=o>=</span>level:s0:c100,c200 -it fedora bash
</span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>Automatic translation of MLS labels isn't supported.</p></blockquote><p>To disable the security labeling for a container entirely, you can use
<code>label=disable</code>:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tc2VjdXJpdHktb3B0IGxhYmVsPWRpc2FibGUgLWl0IHVidW50dSBiYXNo', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --security-opt <span class=nv>label</span><span class=o>=</span>disable -it ubuntu bash
</span></span></code></pre></div></div></div><p>If you want a tighter security policy on the processes within a container, you
can specify a custom <code>type</code> label. The following example runs a container
that's only allowed to listen on Apache ports:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tc2VjdXJpdHktb3B0IGxhYmVsPXR5cGU6c3ZpcnRfYXBhY2hlX3QgLWl0IHVidW50dSBiYXNo', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --security-opt <span class=nv>label</span><span class=o>=</span>type:svirt_apache_t -it ubuntu bash
</span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>You would have to write policy defining a <code>svirt_apache_t</code> type.</p></blockquote><p>To prevent your container processes from gaining additional privileges, you can
use the following command:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tc2VjdXJpdHktb3B0IG5vLW5ldy1wcml2aWxlZ2VzIC1pdCB1YnVudHUgYmFzaA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --security-opt no-new-privileges -it ubuntu bash
</span></span></code></pre></div></div></div><p>This means that commands that raise privileges such as <code>su</code> or <code>sudo</code> no longer work.
It also causes any seccomp filters to be applied later, after privileges have been dropped
which may mean you can have a more restrictive set of filters.
For more details, see the
<a class=link href=https://www.kernel.org/doc/Documentation/prctl/no_new_privs.txt target=_blank rel=noopener>kernel documentation<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p><p>On Windows, you can use the <code>--security-opt</code> flag to specify the <code>credentialspec</code> option.
The <code>credentialspec</code> must be in the format <code>file://spec.txt</code> or <code>registry://keyname</code>.</p><h3 class=scroll-mt-20 id=stop-timeout><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#stop-timeout">Stop container with timeout (--stop-timeout)</a></h3><p>The <code>--stop-timeout</code> flag sets the number of seconds to wait for the container
to stop after sending the pre-defined (see <code>--stop-signal</code>) system call signal.
If the container does not exit after the timeout elapses, it's forcibly killed
with a <code>SIGKILL</code> signal.</p><p>If you set <code>--stop-timeout</code> to <code>-1</code>, no timeout is applied, and the daemon
waits indefinitely for the container to exit.</p><p>The Daemon determines the default, and is 10 seconds for Linux containers,
and 30 seconds for Windows containers.</p><h3 class=scroll-mt-20 id=isolation><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#isolation">Specify isolation technology for container (--isolation)</a></h3><p>This option is useful in situations where you are running Docker containers on
Windows. The <code>--isolation=&lt;value></code> option sets a container's isolation technology.
On Linux, the only supported is the <code>default</code> option which uses Linux namespaces.
These two commands are equivalent on Linux:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC1kIGJ1c3lib3ggdG9wCiQgZG9ja2VyIHJ1biAtZCAtLWlzb2xhdGlvbiBkZWZhdWx0IGJ1c3lib3ggdG9w', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run -d busybox top
</span></span><span class=line><span class=cl><span class=gp>$</span> docker run -d --isolation default busybox top
</span></span></code></pre></div></div></div><p>On Windows, <code>--isolation</code> can take one of these values:</p><table><thead><tr><th style=text-align:left>Value</th><th style=text-align:left>Description</th></tr></thead><tbody><tr><td style=text-align:left><code>default</code></td><td style=text-align:left>Use the value specified by the Docker daemon's <code>--exec-opt</code> or system default (see below).</td></tr><tr><td style=text-align:left><code>process</code></td><td style=text-align:left>Shared-kernel namespace isolation.</td></tr><tr><td style=text-align:left><code>hyperv</code></td><td style=text-align:left>Hyper-V hypervisor partition-based isolation.</td></tr></tbody></table><p>The default isolation on Windows server operating systems is <code>process</code>, and <code>hyperv</code>
on Windows client operating systems, such as Windows 10. Process isolation has better
performance, but requires that the image and host use the same kernel version.</p><p>On Windows server, assuming the default configuration, these commands are equivalent
and result in <code>process</code> isolation:</p><div class="group relative"><button x-data="{ code: 'UFMgQzpcPiBkb2NrZXIgcnVuIC1kIG1pY3Jvc29mdC9uYW5vc2VydmVyIHBvd2Vyc2hlbGwgZWNobyBwcm9jZXNzClBTIEM6XD4gZG9ja2VyIHJ1biAtZCAtLWlzb2xhdGlvbiBkZWZhdWx0IG1pY3Jvc29mdC9uYW5vc2VydmVyIHBvd2Vyc2hlbGwgZWNobyBwcm9jZXNzClBTIEM6XD4gZG9ja2VyIHJ1biAtZCAtLWlzb2xhdGlvbiBwcm9jZXNzIG1pY3Jvc29mdC9uYW5vc2VydmVyIHBvd2Vyc2hlbGwgZWNobyBwcm9jZXNz', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-powershell data-lang=powershell><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-d</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>echo </span><span class=k>process</span>
</span></span><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-d</span> <span class=p>-</span><span class=n>-isolation</span> <span class=k>default</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>echo </span><span class=k>process</span>
</span></span><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-d</span> <span class=p>-</span><span class=n>-isolation</span> <span class=k>process</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>echo </span><span class=k>process</span></span></span></code></pre></div></div></div><p>If you have set the <code>--exec-opt isolation=hyperv</code> option on the Docker <code>daemon</code>, or
are running against a Windows client-based daemon, these commands are equivalent and
result in <code>hyperv</code> isolation:</p><div class="group relative"><button x-data="{ code: 'UFMgQzpcPiBkb2NrZXIgcnVuIC1kIG1pY3Jvc29mdC9uYW5vc2VydmVyIHBvd2Vyc2hlbGwgZWNobyBoeXBlcnYKUFMgQzpcPiBkb2NrZXIgcnVuIC1kIC0taXNvbGF0aW9uIGRlZmF1bHQgbWljcm9zb2Z0L25hbm9zZXJ2ZXIgcG93ZXJzaGVsbCBlY2hvIGh5cGVydgpQUyBDOlw+IGRvY2tlciBydW4gLWQgLS1pc29sYXRpb24gaHlwZXJ2IG1pY3Jvc29mdC9uYW5vc2VydmVyIHBvd2Vyc2hlbGwgZWNobyBoeXBlcnY=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-powershell data-lang=powershell><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-d</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>echo </span><span class=n>hyperv</span>
</span></span><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-d</span> <span class=p>-</span><span class=n>-isolation</span> <span class=k>default</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>echo </span><span class=n>hyperv</span>
</span></span><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-d</span> <span class=p>-</span><span class=n>-isolation</span> <span class=n>hyperv</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>echo </span><span class=n>hyperv</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=memory><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#memory">Specify hard limits on memory available to containers (-m, --memory)</a></h3><p>These parameters always set an upper limit on the memory available to the container. Linux sets this
on the cgroup and applications in a container can query it at <code>/sys/fs/cgroup/memory/memory.limit_in_bytes</code>.</p><p>On Windows, this affects containers differently depending on what type of isolation you use.</p><ul><li><p>With <code>process</code> isolation, Windows reports the full memory of the host system, not the limit to applications running inside the container</p><div class="group relative"><button x-data="{ code: 'UFMgQzpcPiBkb2NrZXIgcnVuIC1pdCAtbSAyR0IgLS1pc29sYXRpb249cHJvY2VzcyBtaWNyb3NvZnQvbmFub3NlcnZlciBwb3dlcnNoZWxsIEdldC1Db21wdXRlckluZm8gKm1lbW9yeSoKCkNzVG90YWxQaHlzaWNhbE1lbW9yeSAgICAgIDogMTcwNjQ1MDk0NDAKQ3NQaHlpY2FsbHlJbnN0YWxsZWRNZW1vcnkgOiAxNjc3NzIxNgpPc1RvdGFsVmlzaWJsZU1lbW9yeVNpemUgICA6IDE2NjY0NTYwCk9zRnJlZVBoeXNpY2FsTWVtb3J5ICAgICAgIDogMTQ2NDY3MjAKT3NUb3RhbFZpcnR1YWxNZW1vcnlTaXplICAgOiAxOTE1NDkyOApPc0ZyZWVWaXJ0dWFsTWVtb3J5ICAgICAgICA6IDE3MTk3NDQwCk9zSW5Vc2VWaXJ0dWFsTWVtb3J5ICAgICAgIDogMTk1NzQ4OApPc01heFByb2Nlc3NNZW1vcnlTaXplICAgICA6IDEzNzQzODk1MzM0NA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-powershell data-lang=powershell><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-it</span> <span class=n>-m</span> <span class=mf>2</span><span class=p>GB</span> <span class=p>-</span><span class=n>-isolation</span><span class=p>=</span><span class=k>process</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>Get-ComputerInfo</span> <span class=p>*</span><span class=n>memory</span><span class=p>*</span>
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl><span class=n>CsTotalPhysicalMemory</span>      <span class=err>:</span> <span class=mf>17064509440</span>
</span></span><span class=line><span class=cl><span class=n>CsPhyicallyInstalledMemory</span> <span class=err>:</span> <span class=mf>16777216</span>
</span></span><span class=line><span class=cl><span class=n>OsTotalVisibleMemorySize</span>   <span class=err>:</span> <span class=mf>16664560</span>
</span></span><span class=line><span class=cl><span class=n>OsFreePhysicalMemory</span>       <span class=err>:</span> <span class=mf>14646720</span>
</span></span><span class=line><span class=cl><span class=n>OsTotalVirtualMemorySize</span>   <span class=err>:</span> <span class=mf>19154928</span>
</span></span><span class=line><span class=cl><span class=n>OsFreeVirtualMemory</span>        <span class=err>:</span> <span class=mf>17197440</span>
</span></span><span class=line><span class=cl><span class=n>OsInUseVirtualMemory</span>       <span class=err>:</span> <span class=mf>1957488</span>
</span></span><span class=line><span class=cl><span class=n>OsMaxProcessMemorySize</span>     <span class=err>:</span> <span class=mf>137438953344</span></span></span></code></pre></div></div></div></li><li><p>With <code>hyperv</code> isolation, Windows creates a utility VM that is big enough to hold the memory limit, plus the minimal OS needed to host the container. That size is reported as "Total Physical Memory."</p><div class="group relative"><button x-data="{ code: 'UFMgQzpcPiBkb2NrZXIgcnVuIC1pdCAtbSAyR0IgLS1pc29sYXRpb249aHlwZXJ2IG1pY3Jvc29mdC9uYW5vc2VydmVyIHBvd2Vyc2hlbGwgR2V0LUNvbXB1dGVySW5mbyAqbWVtb3J5KgoKQ3NUb3RhbFBoeXNpY2FsTWVtb3J5ICAgICAgOiAyNjgzMzU1MTM2CkNzUGh5aWNhbGx5SW5zdGFsbGVkTWVtb3J5IDoKT3NUb3RhbFZpc2libGVNZW1vcnlTaXplICAgOiAyNjIwNDY0Ck9zRnJlZVBoeXNpY2FsTWVtb3J5ICAgICAgIDogMjMwNjU1MgpPc1RvdGFsVmlydHVhbE1lbW9yeVNpemUgICA6IDI2MjA0NjQKT3NGcmVlVmlydHVhbE1lbW9yeSAgICAgICAgOiAyMzU2NjkyCk9zSW5Vc2VWaXJ0dWFsTWVtb3J5ICAgICAgIDogMjYzNzcyCk9zTWF4UHJvY2Vzc01lbW9yeVNpemUgICAgIDogMTM3NDM4OTUzMzQ0', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-powershell data-lang=powershell><span class=line><span class=cl><span class=nb>PS </span><span class=n>C:</span><span class=p>\&gt;</span> <span class=n>docker</span> <span class=n>run</span> <span class=n>-it</span> <span class=n>-m</span> <span class=mf>2</span><span class=p>GB</span> <span class=p>-</span><span class=n>-isolation</span><span class=p>=</span><span class=n>hyperv</span> <span class=n>microsoft</span><span class=p>/</span><span class=n>nanoserver</span> <span class=n>powershell</span> <span class=nb>Get-ComputerInfo</span> <span class=p>*</span><span class=n>memory</span><span class=p>*</span>
</span></span><span class=line><span class=cl>
</span></span><span class=line><span class=cl><span class=n>CsTotalPhysicalMemory</span>      <span class=err>:</span> <span class=mf>2683355136</span>
</span></span><span class=line><span class=cl><span class=n>CsPhyicallyInstalledMemory</span> <span class=err>:</span>
</span></span><span class=line><span class=cl><span class=n>OsTotalVisibleMemorySize</span>   <span class=err>:</span> <span class=mf>2620464</span>
</span></span><span class=line><span class=cl><span class=n>OsFreePhysicalMemory</span>       <span class=err>:</span> <span class=mf>2306552</span>
</span></span><span class=line><span class=cl><span class=n>OsTotalVirtualMemorySize</span>   <span class=err>:</span> <span class=mf>2620464</span>
</span></span><span class=line><span class=cl><span class=n>OsFreeVirtualMemory</span>        <span class=err>:</span> <span class=mf>2356692</span>
</span></span><span class=line><span class=cl><span class=n>OsInUseVirtualMemory</span>       <span class=err>:</span> <span class=mf>263772</span>
</span></span><span class=line><span class=cl><span class=n>OsMaxProcessMemorySize</span>     <span class=err>:</span> <span class=mf>137438953344</span></span></span></code></pre></div></div></div></li></ul><h3 class=scroll-mt-20 id=sysctl><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#sysctl">Configure namespaced kernel parameters (sysctls) at runtime (--sysctl)</a></h3><p>The <code>--sysctl</code> sets namespaced kernel parameters (sysctls) in the
container. For example, to turn on IP forwarding in the containers
network namespace, run this command:</p><div class="group relative"><button x-data="{ code: 'JCBkb2NrZXIgcnVuIC0tc3lzY3RsIG5ldC5pcHY0LmlwX2ZvcndhcmQ9MSBzb21laW1hZ2U=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> docker run --sysctl net.ipv4.ip_forward<span class=o>=</span><span class=m>1</span> someimage
</span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>Not all sysctls are namespaced. Docker does not support changing sysctls
inside of a container that also modify the host system. As the kernel
evolves we expect to see more sysctls become namespaced.</p></blockquote><h4 class=scroll-mt-20 id=currently-supported-sysctls><a class="text-black dark:text-white no-underline hover:underline" href="../../../../../engine/reference/commandline/run/index.html#currently-supported-sysctls">Currently supported sysctls</a></h4><p>IPC Namespace:</p><ul><li><code>kernel.msgmax</code>, <code>kernel.msgmnb</code>, <code>kernel.msgmni</code>, <code>kernel.sem</code>,
<code>kernel.shmall</code>, <code>kernel.shmmax</code>, <code>kernel.shmmni</code>, <code>kernel.shm_rmid_forced</code>.</li><li>Sysctls beginning with <code>fs.mqueue.*</code></li><li>If you use the <code>--ipc=host</code> option these sysctls are not allowed.</li></ul><p>Network Namespace:</p><ul><li>Sysctls beginning with <code>net.*</code></li><li>If you use the <code>--network=host</code> option using these sysctls are not allowed.</li></ul></article></div><div class="sticky top-16 h-screen w-[300px] shrink grow overflow-y-scroll lg:hidden"><aside class="space-y-4 lg:hidden w-[300px]"><div class="text-lg pb-2">Contents</div><nav id=TableOfContents><ul><li class=pl-2><a href="../../../../../engine/reference/commandline/run/index.html#description">Description</a></li><li class=pl-2><a href="../../../../../engine/reference/commandline/run/index.html#options">Options</a></li><li class=pl-2><a href="../../../../../engine/reference/commandline/run/index.html#examples">Examples</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#name">Assign name (--name)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#cidfile">Capture container ID (--cidfile)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#pid">PID settings (--pid)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#example-run-htop-inside-a-container">Example: run htop inside a container</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#example-join-another-containers-pid-namespace">Example, join another container's PID namespace</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#uts">UTS settings (--uts)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#ipc">IPC settings (--ipc)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#privileged">Full container capabilities (--privileged)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#workdir">Set working directory (-w, --workdir)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#storage-opt">Set storage driver options per container (--storage-opt)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#tmpfs">Mount tmpfs (--tmpfs)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#volume">Mount volume (-v)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#read-only">Mount volume read-only (--read-only)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#mount">Add bind mounts or volumes using the --mount flag</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#publish">Publish or expose port (-p, --expose)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#publish-all">Publish all exposed ports (-P, --publish-all)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#pull">Set the pull policy (--pull)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#env">Set environment variables (-e, --env, --env-file)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#label">Set metadata on container (-l, --label, --label-file)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#network">Connect a container to a network (--network)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#volumes-from">Mount volumes from container (--volumes-from)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#detach">Detached mode (-d, --detach)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#detach-keys">Override the detach sequence (--detach-keys)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#device">Add host device to container (--device)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#cdi-devices">CDI devices</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#attach">Attach to STDIN/STDOUT/STDERR (-a, --attach)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#interactive">Keep STDIN open (-i, --interactive)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#init">Specify an init process</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#tty">Allocate a pseudo-TTY (-t, --tty)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#cgroup-parent">Specify custom cgroups</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#device-cgroup-rule">Using dynamically created devices (--device-cgroup-rule)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#gpus">Access an NVIDIA GPU</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#restart">Restart policies (--restart)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#specify-a-limit-for-restart-attempts">Specify a limit for restart attempts</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#inspect-container-restarts">Inspect container restarts</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#rm">Clean up (--rm)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#add-host">Add entries to container hosts file (--add-host)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#log-driver">Logging drivers (--log-driver)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#ulimit">Set ulimits in container (--ulimit)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#for-nproc-usage">For `nproc` usage</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#stop-signal">Stop container with signal (--stop-signal)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#security-opt">Optional security options (--security-opt)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#stop-timeout">Stop container with timeout (--stop-timeout)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#isolation">Specify isolation technology for container (--isolation)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#memory">Specify hard limits on memory available to containers (-m, --memory)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#sysctl">Configure namespaced kernel parameters (sysctls) at runtime (--sysctl)</a></li><li class=pl-4><a href="../../../../../engine/reference/commandline/run/index.html#currently-supported-sysctls">Currently supported sysctls</a></li></ul></nav></aside></div></main><footer><div class="flex justify-center py-20 px-4 bg-gray-light-200/50 dark:bg-gray-dark-300/50"><div class="flex w-[1200px] flex-col gap-10"><div class="flex sm:flex-col gap-4 items-center justify-evenly"><a class="underline-offset-2 hover:underline" href=https://www.docker.com/>Product offerings</a>
<a class="underline-offset-2 hover:underline" href=https://www.docker.com/pricing/>Pricing</a>
<a class="underline-offset-2 hover:underline" href=https://www.docker.com/company/>About us</a>
<a class="underline-offset-2 hover:underline" href=https://www.docker.com/support/>Support</a>
<a class="underline-offset-2 hover:underline" href=https://github.com/docker/docs/blob/main/CONTRIBUTING.md>Contribute</a></div><hr class="text-divider-light dark:text-divider-dark"><div class="grid grid-cols-3 place-items-center gap-8 md:grid-cols-1"><p class=text-sm>Copyright © 2013-2024 Docker Inc. All rights reserved.</p><div class="flex gap-4"><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title="X (Twitter)" href=http://twitter.com/docker/><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M14.62 13.41l-3.3-4.62H9.56l4.09 5.72.51.72 3.51 4.91h1.76l-4.29-6.01-.52-.72z"/><path class="cls-1" d="M14.5.0A14.5 14.5.0 1029 14.5 14.5 14.5.0 0014.5.0zm2.63 20.94-3.55-5.05-4.43 5.05H8l5.07-5.77L8 7.94h3.87l3.36 4.78 4.2-4.78h1.15l-4.84 5.51L21 20.94z"/></g></g></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=LinkedIn href=https://www.linkedin.com/company/docker><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 24c6.627.0 12-5.373 12-12S18.627.0 12 0 0 5.373.0 12s5.373 12 12 12zM8.176 9.66H5.174v9.035h3.002V9.66zm-3.18-2.795c0-.885.671-1.56 1.699-1.56 1.027.0 1.66.675 1.679 1.56.0.867-.652 1.562-1.7 1.562h-.018c-1.008.0-1.66-.695-1.66-1.562zm7.845 4.074c.398-.614 1.112-1.49 2.706-1.49 1.976.0 3.457 1.29 3.457 4.065v5.18h-3.002v-4.833c0-1.214-.435-2.043-1.522-2.043-.829.0-1.323.559-1.54 1.098-.08.194-.099.463-.099.733v5.046H9.838s.04-8.187.0-9.035h3.003v1.28z"/></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=Instagram href=https://www.instagram.com/dockerinc/><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 24c6.627.0 12-5.373 12-12S18.627.0 12 0 0 5.373.0 12s5.373 12 12 12zM6.984 4.774c.485-.19 1.04-.32 1.853-.359.814-.039 1.074-.048 3.148-.052 2.075-.004 2.335.004 3.15.04.812.035 1.368.164 1.853.352.503.193.93.454 1.355.878s.687.849.883 1.35c.19.486.32 1.041.359 1.854.038.815.048 1.074.052 3.148s-.005 2.335-.04 3.15c-.036.812-.164 1.368-.352 1.854a3.737 3.737.0 01-.878 1.354 3.746 3.746.0 01-1.35.884c-.486.19-1.04.32-1.853.358-.815.039-1.075.048-3.15.052-2.073.004-2.333-.004-3.148-.04-.813-.036-1.369-.163-1.854-.351a3.746 3.746.0 01-1.355-.878 3.74 3.74.0 01-.883-1.352c-.19-.485-.32-1.04-.359-1.852-.039-.815-.048-1.075-.052-3.15-.004-2.073.004-2.333.04-3.148.036-.813.163-1.368.351-1.855.195-.502.455-.929.879-1.354a3.736 3.736.0 011.35-.883zm.523 13.189c.27.103.674.227 1.419.26.806.034 1.047.042 3.086.038 2.04-.004 2.28-.012 3.086-.05.744-.036 1.148-.16 1.417-.266.357-.14.61-.306.877-.573.267-.268.432-.522.57-.879.104-.27.228-.674.26-1.419.035-.805.043-1.047.039-3.086-.004-2.039-.012-2.28-.05-3.086-.036-.744-.16-1.149-.266-1.417a2.366 2.366.0 00-.573-.878 2.364 2.364.0 00-.88-.57c-.269-.103-.674-.227-1.418-.26-.805-.034-1.047-.042-3.086-.038-2.04.004-2.28.012-3.086.05-.744.036-1.148.16-1.417.266a2.38 2.38.0 00-.878.573 2.37 2.37.0 00-.57.88c-.103.269-.227.674-.26 1.418-.034.805-.042 1.047-.038 3.086.004 2.04.013 2.28.05 3.086.035.744.161 1.148.266 1.418.14.356.305.61.573.877.268.266.522.431.88.57zm8.563-9.131a.917.917.0 11-.003-1.833.917.917.0 01.003 1.833zm-4.063 7.09a3.921 3.921.0 11-.015-7.843 3.921 3.921.0 01.015 7.842zm-.012-6.468a2.546 2.546.0 10.01 5.092 2.546 2.546.0 00-.01-5.092z"/></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=YouTube href=http://www.youtube.com/user/dockerrun><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 24c6.627.0 12-5.373 12-12S18.627.0 12 0 0 5.373.0 12s5.373 12 12 12zm7.543-15.79a1.971 1.971.0 00-1.392-1.39C16.923 6.49 12 6.49 12 6.49s-4.924.0-6.152.33A1.972 1.972.0 004.457 8.21c-.33 1.229-.33 3.79-.33 3.79s0 2.562.33 3.79c.18.677.714 1.21 1.391 1.391 1.228.329 6.151.329 6.151.329s4.923.0 6.15-.329a1.972 1.972.0 001.393-1.392c.329-1.227.329-3.789.329-3.789s0-2.561-.33-3.79zm-9.117 6.151L14.516 12l-4.09-2.361v4.722z"/></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=Facebook href=https://www.facebook.com/docker.run><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.54 24c5.948-.736 10.552-5.807 10.552-11.954C24.092 5.393 18.699.0 12.046.0S0 5.393.0 12.046c0 5.842 4.158 10.712 9.677 11.813v-8.374H6.538v-3.573h3.139V9.188c0-3.098 1.845-4.81 4.669-4.81 1.352.0 2.767.242 2.767.242v3.042h-1.559c-1.536.0-2.014.953-2.014 1.93v2.32h3.428l-.548 3.573h-2.88V24z"/></svg></a></div><div class="flex items-center gap-4"><a class="underline-offset-2 hover:underline" title="Docker Terms of Service" href=https://www.docker.com/legal/docker-terms-service>Terms of Service</a>
<a class="underline-offset-2 hover:underline" title="Docker Systems Status Page" href=https://www.dockerstatus.com/>Status</a>
<a class="underline-offset-2 hover:underline" title="Docker Legal Terms" href=https://www.docker.com/legal>Legal</a></div></div></div></div></footer></body></html>